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

Commit

Permalink
Remainder operation rounding (#104)
Browse files Browse the repository at this point in the history
* Remove rounding mode option to `remainder`

Not needed.

* Document the remainder change
  • Loading branch information
jessealama authored Apr 15, 2024
1 parent 900d4a7 commit 4379001
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [12.2.0] - 2024-04-15

### Changed

- The remainder operation no longer takes an optional argument for specifying the rounding mode. It is unnecessary.

## [12.1.0] - 2024-04-11

### Added
Expand Down
5 changes: 2 additions & 3 deletions src/decimal128.mts
Original file line number Diff line number Diff line change
Expand Up @@ -1534,10 +1534,9 @@ export class Decimal128 {
* Return the remainder of this Decimal128 value divided by another Decimal128 value.
*
* @param d
* @param opts
* @throws RangeError If argument is zero
*/
remainder(d: Decimal128, opts?: ArithmeticOperationOptions): Decimal128 {
remainder(d: Decimal128): Decimal128 {
if (this.isNaN || d.isNaN) {
return new Decimal128(NAN);
}
Expand All @@ -1563,7 +1562,7 @@ export class Decimal128 {
}

let q = this.divide(d).round(0, ROUNDING_MODE_TRUNCATE);
return this.subtract(d.multiply(q), opts);
return this.subtract(d.multiply(q));
}

private decrementExponent(): Decimal128 {
Expand Down

0 comments on commit 4379001

Please sign in to comment.