R
Ryo
Hi all,
I thought ".to_s.to_f" should be an identity operation on any floating
point number, apart from a potential truncation error.
On Ruby 1.8.7,
a = 0.0/0.0
a.to_s # => "NaN"
"NaN".to_f #=> 0.0
Therefore,
a.to_s.to_f #=> 0.0,
which isn't acceptable to me. Consider writing floating point numbers
to a text file and reading them back in.
Is this a bug in 1.8.x? I searched Google but couldn't get a
definitive answer.
Regards,
Ryo
I thought ".to_s.to_f" should be an identity operation on any floating
point number, apart from a potential truncation error.
On Ruby 1.8.7,
a = 0.0/0.0
a.to_s # => "NaN"
"NaN".to_f #=> 0.0
Therefore,
a.to_s.to_f #=> 0.0,
which isn't acceptable to me. Consider writing floating point numbers
to a text file and reading them back in.
Is this a bug in 1.8.x? I searched Google but couldn't get a
definitive answer.
Regards,
Ryo