Actions
Bug #9595
closedFloat#to_d inconsistent between 2.0.0 and 2.1.1
ruby -v:
ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
Backport:
Tags:
Description
The following code produces different BigDecimal results in 2.0.0 vs. 2.1.1:
require 'big decimal'
require 'bigdecimal/util'
(1/1.3667).to_d
2.0.0 returns: #<BigDecimal:7fa7fc04dc28,'0.7316894709 885124E0',18(45)>
2.1.1 returns: #<BigDecimal:7fabd1a25768,'0.7316894709 88512E0',18(36)>
2.1.1 is a digit short. Related to #9305?
Updated by boone (Mike Boone) about 10 years ago
I did come across this Github PR (https://github.com/ruby/ruby/pull/323) which changed the default precision on Float#to_d.
If 2.1.1 is the proper behavior and compatibility with the behavior of 2.0.0 is not desired, please close this bug.
Thanks.
Updated by mrkn (Kenta Murata) about 10 years ago
- Category set to ext
- Status changed from Open to Assigned
- Assignee set to mrkn (Kenta Murata)
Updated by jeremyevans0 (Jeremy Evans) over 3 years ago
- Status changed from Assigned to Rejected
- Backport deleted (
1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN)
BigDecimal behavior has remained the same since 2.1, and 2.0's excessive precision was actually a bug, fixed in 1699396fe502d929ced019dc0dd3463a35fbf6d3.
Actions
Like0
Like0Like0Like0