0.01.to_s -> "1.0"

  • Thread starter Andriy Tabachyn
  • Start date
A

Andriy Tabachyn

Hi,

I located very strange behavior of float under Linux. 0.123 is converted
to 123.0
under windows 0.123 is converted correctly to 0.123.

Here is samples:
ruby -v ruby 1.8.6 (2009-08-04 patchlevel 383) [i686-linux]
irb
irb(main):001:0> 0.123.to_s
=> "123.0"

C:\>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
C:\>irb
irb(main):001:0> 0.123.to_s
=> "0.123"

How to receive correct float under Linux. Please advice.

Thank you.
Andriy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top