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

compatability: floating point formatted differently by default #1626

Open
ntysdd opened this issue Mar 19, 2019 · 3 comments

Comments

3 participants
@ntysdd
Copy link

commented Mar 19, 2019

test code
puts 1.0 / 7

MRI
0.14285714285714285

TruffleRuby
0.142857142857143

this may prevent truffle ruby being a drop in replacement for MRI in some situation

@Maumagnaguagno

This comment has been minimized.

Copy link

commented Mar 19, 2019

I was also surprised by this difference between MRI and TruffleRuby.
This difference should be stated in doc/user/compatibility.md or modified to match MRI behavior.

@chrisseaton

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

Thanks for the report! This is an unintended bug we'll fix - it's not intentionally different from MRI.

@chrisseaton

This comment has been minimized.

Copy link
Member

commented Mar 19, 2019

I can fix your specific test case, but it's a bit more complex making it exactly match MRI for all cases (and fixing yours caused others to break.)

MRI has custom floating-point formatting code, which doesn't match anything in C or Java. We may need to port their C code to Java.

JRuby has similar problems to us https://github.com/jruby/jruby/blob/5602787e537fe025c40abd785926e10cb34690b0/spec/tags/ruby/core/float/to_s_tags.txt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.