Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time.at(float).to_f rounding issues #1193

Closed
heywhatdoesthisdo opened this issue Oct 31, 2013 · 2 comments
Closed

Time.at(float).to_f rounding issues #1193

heywhatdoesthisdo opened this issue Oct 31, 2013 · 2 comments

Comments

@heywhatdoesthisdo
Copy link

C:\Users\jonabush>jruby -v
jruby 1.7.6 (1.9.3p392) 2013-10-22 6004147 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_45-b18 [Windows 7-amd64]

C:\Users\jonabush>jruby --1.8 -e 'p Time.at(9.99949999999).to_f'
9.9995

C:\Users\jonabush>jruby --1.9 -e 'p Time.at(9.99949999999).to_f'
9.999500000000001

C:\Users\jonabush>jruby --2.0 -e 'p Time.at(9.99949999999).to_f'
9.999500000000001

C:\Users\jonabush>ruby -v
ruby 1.9.2p290 (2011-07-09) [i386-mingw32]

C:\Users\jonabush>ruby -e 'p Time.at(9.99949999999).to_f'
9.99949999999

C:\Users\jonabush>ruby -v
ruby 1.9.3p448 (2013-06-27) [i386-mingw32]

C:\Users\jonabush>ruby -e 'p Time.at(9.99949999999).to_f'
9.99949999999

to_f does not return the same float as that which created the Time object.

@kares
Copy link
Member

kares commented Apr 8, 2016

9K behaves "better" so maybe those bits could get backported to jruby-1_7 as the issue exhibits on 1.7.24 :

kares@sputnik:~/workspace/oss/jruby/test$ rvm use 1.7.24
Using /opt/local/rvm/gems/jruby-1.7.24
kares@sputnik:~/workspace/oss/jruby/test$ jruby --1.9 -e 'p Time.at(9.99949999999).to_f'
9.999500000000001
kares@sputnik:~/workspace/oss/jruby/test$ jruby --1.8 -e 'p Time.at(9.99949999999).to_f'
9.9995
kares@sputnik:~/workspace/oss/jruby/test$ rvm use 9.0.5
Using /opt/local/rvm/gems/jruby-9.0.5.0
kares@sputnik:~/workspace/oss/jruby/test$ jruby -e 'p Time.at(9.99949999999).to_f'
9.999499999000001

@enebo
Copy link
Member

enebo commented Feb 17, 2017

By "better" I take that to mean this issue is not valid as written for 9k. Since 1.7.x will be EOL soon I am resolving this as wontfix

@enebo enebo closed this as completed Feb 17, 2017
@enebo enebo added this to the Won't Fix milestone Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants