diff --git a/src/decimal128.ts b/src/decimal128.ts index 55543a76..9dd72b4f 100644 --- a/src/decimal128.ts +++ b/src/decimal128.ts @@ -434,6 +434,8 @@ export class Decimal128 extends BSONValue { return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER); } } + } else { + break; } } } diff --git a/test/node/decimal128_tests.js b/test/node/decimal128_tests.js index c427c726..2f7394be 100644 --- a/test/node/decimal128_tests.js +++ b/test/node/decimal128_tests.js @@ -477,6 +477,9 @@ describe('Decimal128', function () { expect(bytes).to.deep.equal(result.bytes); + result = Decimal128.fromString('37.499999999999999196428571428571375'); + expect(result.toString()).to.deep.equal('37.49999999999999919642857142857138'); + // // Create decimal from string value 15E-6177 // result = Decimal128.fromString('15E-6177'); // bytes = Buffer.from(