Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Declined
-
Affects Version/s: Release 1.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:
-
Environment:Linux 3.2.0-24-generic #39-Ubuntu SMP i686 GNU/Linux
Description
Hi,
As discussed on the mailing list in the message "When arithmetic on a computer bite back" (01/jun)
There may be bug in the way quotient is implemented for bigdec.
user> (quot 1.4411518807585587E17 2) ;; correct with doubles
7.2057594037927936E16
user> (quot 1.4411518807585587E+17M 2) ;; wrong with BigDecs
72057594037927935M
–
Laurent
Attachments
Activity
laurent joigny
made changes -
| Field | Original Value | New Value |
|---|---|---|
| Attachment | TestBigDecimalQuotient.java [ 11282 ] |
Tassilo Horn
made changes -
| Comment |
[ As demonstrated in the thread on the list (https://groups.google.com/d/topic/clojure/YAb1WlibYgs/discussion), it's possible that this is a general issue with the usual big decimal representation, i.e., Python and Ruby calculate the exact same wrong value:
Python: {noformat} >>> from decimal import * >>> Decimal('1.4411518807585587E17') / Decimal(2) Decimal('72057594037927935') {noformat} Ruby: {noformat} irb(main):012:0> x = BigDecimal.new("1.4411518807585587E17") => #<BigDecimal:7fabd400d958,'0.1441151880 7585587E18',18(27)> irb(main):013:0> x => #<BigDecimal:7fabd400d958,'0.1441151880 7585587E18',18(27)> irb(main):014:0> x / 2 => #<BigDecimal:7fabd4008368,'0.7205759403 7927935E17',18(81)> {noformat} ] |
Stuart Sierra
made changes -
| Resolution | Declined [ 2 ] | |
| Status | Open [ 1 ] | Resolved [ 5 ] |
Stuart Halloway
made changes -
| Status | Resolved [ 5 ] | Closed [ 6 ] |