Skip to content
This repository has been archived by the owner on Jan 15, 2025. It is now read-only.

Commit

Permalink
Some examples showing how we deviate from IEEE 754 remainder
Browse files Browse the repository at this point in the history
  • Loading branch information
jessealama committed Apr 16, 2024
1 parent c2da07e commit 153344e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/remainder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,16 @@ describe("examples from the General Decimal Arithmetic Specification", () => {
).toStrictEqual("1.0");
});
});

describe("not the same as IEEE 754 remainder", () => {
test("42 % 10", () => {
expect(
new Decimal128("42").remainder(new Decimal128("10")).toString()
).toStrictEqual("2");
});
test("46 % 10", () => {
expect(
new Decimal128("46").remainder(new Decimal128("10")).toString()
).toStrictEqual("6");
});
});

0 comments on commit 153344e

Please sign in to comment.