Created
October 23, 2010 14:22
-
-
Save prakashmurthy/642266 to your computer and use it in GitHub Desktop.
Why are these two different? The numbers are the same; just re-arranged.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ruby-1.9.2-rc1 > 707106783028.0 * 1 / 1000000002604.0 * 707106783027.0 / 1000000002603.0 | |
=> 0.49999999999999994 | |
ruby-1.9.2-rc1 > 1 / 1000000002604.0 * 707106783027.0 / 1000000002603.0 * 707106783028.0 | |
=> 0.5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
On ruby 1.8.5 (2006-08-25) [x86_64-linux] they were the same for me.
irb(main):002:0> 707106783028.0 * 1 / 1000000002604.0 * 707106783027.0 / 1000000002603.0
=> 0.5
irb(main):003:0> 1 / 1000000002604.0 * 707106783027.0 / 1000000002603.0 * 707106783028.0
=> 0.5
You got me to install ruby, congrats. I guess this version installed with my centos linux is much older than yours though.