-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: 4.2.1
-
Component/s: js-bson
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
- depends on
-
NODE-3836 Investigate NODE-3835 - Incorrect Decimal128.fromString() for number with more than 34 significant digits
- Closed
- related to
-
DRIVERS-2651 Add decimal128 clamped zeros tests with very large exponents
- Closed