-
Type: Bug
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
What problem are you facing?
the node.js driver uses the js-bson libary which improperly handles Decimal128 numbers with precision greater then 34 decimal places.
Example:
var { Decimal128 } = require("mongodb")
const num = Decimal128.fromString('37.499999999999999196428571428571375')
num.toString() // result is "48.50000000000000020753968253968248"
What driver and relevant dependency versions are you using?
mongodb-node > 4.0
the bug is in the dependency `js-bson`
Steps to reproduce?
use the Decimal128.fromString function on any number with a precision greater then 34.
const { Decimal128 } = require("mongodb")
const num = Decimal128.fromString('37.499999999999999196428571428571375')
num.toString() // result is "48.50000000000000020753968253968248"
- is related to
-
NODE-5515 Decimal128 gives weird results
- Closed
- related to
-
DRIVERS-2651 Add decimal128 clamped zeros tests with very large exponents
- Closed
- links to