mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* math.c (to_flo): rb_Float() accepts even strings for input.
* complex.c (nucomp_to_f): fix wrong message. * complex.c (nucomp_to_r): ditto. * object.c (rb_Float): do not check NaN for error. NaN is a part of valid float values. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16429 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b8118e9645
commit
f970ffedae
6 changed files with 32 additions and 14 deletions
|
@ -1093,7 +1093,7 @@ nucomp_to_f(VALUE self)
|
|||
|
||||
if (k_float_p(dat->image) || !f_zero_p(dat->image)) {
|
||||
VALUE s = f_to_s(self);
|
||||
rb_raise(rb_eRangeError, "can't convert %s into Integer",
|
||||
rb_raise(rb_eRangeError, "can't convert %s into Float",
|
||||
StringValuePtr(s));
|
||||
}
|
||||
return f_to_f(dat->real);
|
||||
|
@ -1106,7 +1106,7 @@ nucomp_to_r(VALUE self)
|
|||
|
||||
if (k_float_p(dat->image) || !f_zero_p(dat->image)) {
|
||||
VALUE s = f_to_s(self);
|
||||
rb_raise(rb_eRangeError, "can't convert %s into Integer",
|
||||
rb_raise(rb_eRangeError, "can't convert %s into Rational",
|
||||
StringValuePtr(s));
|
||||
}
|
||||
return f_to_r(dat->real);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue