Actions
Bug #6955
closedUnexpected result of BigDecimal('1e-324').to_f on Windows
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.0.0dev (2012-08-30 trunk 36856) [i386-mswin32_100]
Backport:
Description
After applying r36854, BigDecimal('1e-324').to_f returns "-0.0" instead of "0.0".
C:>ruby -rbigdecimal -ve "p BigDecimal('1e-323').to_f"
ruby 2.0.0dev (2012-08-30 trunk 36856) [i386-mswin32_100]
1.0e-323
C:>ruby -rbigdecimal -ve "p BigDecimal('1e-324').to_f"
ruby 2.0.0dev (2012-08-30 trunk 36856) [i386-mswin32_100]
-0.0
C:>ruby -rbigdecimal -ve "p BigDecimal('1e-325').to_f"
ruby 2.0.0dev (2012-08-30 trunk 36856) [i386-mswin32_100]
0.0
C:>ruby -rbigdecimal -ve "p BigDecimal('1e-326').to_f"
ruby 2.0.0dev (2012-08-30 trunk 36856) [i386-mswin32_100]
0.0
Updated by usa (Usaku NAKAMURA) over 11 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36865.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
- ext/bigdecimal/bigdecimal.c (BigDecimal_to_f): use self's sign to
determine 0.0 and Inf's sign instead of internal double value's.
Reported by phasis68 (Heesob Park) at [ruby-core:47381] [Bug #6955]
Actions
Like0
Like0