[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a double parameter.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11320 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-06-26 01:49:33 +00:00
commit 45611ebd57
3 changed files with 8 additions and 1 deletions

View file

@ -1,6 +1,10 @@
Version 1.3.40 (in progress)
============================
2009-06-26: olly
[Ruby] Fix to handle FIXNUM values greater than MAXINT passed for a
double parameter.
2009-06-24: wsfulton
Fix wrapping methods with default arguments and the compactdefaultargs feature
where a class is passed by value and is assigned a default value. The SwigValueWrapper

View file

@ -50,6 +50,9 @@ end
raise RuntimeError if fail != 1
# Test a number which won't fit in a 32 bit integer and is represented
# as a FIXNUM by Ruby.
raise RuntimeError if val_double(51767811298) != 51767811298
raise RuntimeError if val_double_2(1.0) != 4.0
raise RuntimeError if val_double_2(1) != 4

View file

@ -197,7 +197,7 @@ SWIG_AsVal_dec(unsigned long long)(VALUE obj, unsigned long long *val)
}
%fragment(SWIG_AsVal_frag(double),"header",fragment="SWIG_ruby_failed") {
%ruby_aux_method(double, NUM2DBL, (type == T_FLOAT ? NUM2DBL(obj) : (type == T_FIXNUM ? (double) FIX2INT(obj) : rb_big2dbl(obj))))
%ruby_aux_method(double, NUM2DBL, NUM2DBL(obj))
SWIGINTERN int
SWIG_AsVal_dec(double)(VALUE obj, double *val)