-
Type: Task
-
Resolution: Done
-
Priority: Critical - P2
-
None
-
Affects Version/s: None
-
Component/s: None
NODE-3835 Description
What problem are you facing?
Incorrect Decimal128.fromString() for number with more than 34 significant digits.
What driver and relevant dependency versions are you using?
node.js native mongodb driver 4.2.1 with bson 4.6.0
Steps to reproduce?
Decimal128.fromString('-46254.999999999999999132718749999999999998843625').toString()
// got the wrong number -57365.00000000000000024382985000000
Decimal128.fromString('-46254.99999999999999913271874999999').toString()
// got the correct number -46254.9999999999999991327187499999
Note that bson 1.x doesn't have this bug.
// in bson 1.x
Decimal128.fromString('-46254.999999999999999132718749999999999998843625').toString()
// got the correct rounded number -46254.99999999999999913271875000000
- is depended on by
-
NODE-3835 Incorrect Decimal128.fromString() for number with more than 34 significant digits
- Backlog