[BUG] String#to_f spec fails on "-0"
Reported by Ben Hughes | February 3rd, 2008 @ 10:46 AM | in 1.0 preview
MRI returns -0.0 for both "-0".to_f and "-0.0".to_f while Rubinius only returns -0.0 for "-0.0".to_f this causes "String#to_f takes an optional sign" to fail
Comments and changes to this ticket
-
Ruben Nine February 3rd, 2008 @ 07:44 PM
Hi Ben,
I'm unable to reproduce that one in trunk:
$ shotgun/rubinius irb(main):001:0> "-0".to_f => -0.0 irb(main):002:0> "-0.0".to_f => -0.0 -
Ben Hughes February 3rd, 2008 @ 08:13 PM
on linux/x86_64
$ git pull
Already up-to-date.
$ shotgun/rubinius
irb(main):001:0> "-0".to_f
=> 0.0
-
Ruben Nine February 4th, 2008 @ 08:53 AM
Interesting.
Looks like it might be a platform specific issue.
(I tested on an intel mac running OS X 10.5.1)
-
zimbatm February 4th, 2008 @ 02:26 PM
- → State changed from new to open
works on linux/x86_32. seems like a 64bit issue
-
Federico Builes February 10th, 2008 @ 05:59 PM
Cannot reproduce on OS X 10.5.1 on an Intel processor either:
irb(main):002:0> "-0".to_f
=> -0.0
irb(main):003:0> "-0.".to_f
=> -0.0
irb(main):004:0> "-0.0".to_f
=> -0.0
-
Donald Luo February 15th, 2008 @ 10:01 AM
I have this this problem too with my Gutsy x86_32. I think it was caused by an error in strtod() in libc6 that has been fixed here. That means you will have this problem if you use libc6 version <= 2.6.1.
-
Ryan Davis February 29th, 2008 @ 04:01 PM
- → Assigned user changed from to Ryan Davis
-
Brian Ford March 5th, 2008 @ 09:10 AM
This bug will be resolved when we take the same approach that MRI does and use a single, imported version of strtod. See #379.
-
Brian Ford March 14th, 2008 @ 06:17 PM
- → State changed from open to resolved
Should be fixed with the inclusion of shotgun/external_libs/libgdtoa.
Closing for now. Reopen if needed.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
