@@ -861,10 +861,6 @@ const DEFAULT_CONSTRUCTOR_OPTIONS: FullySpecifiedConstructorOptions =
861
861
normalize : CONSTRUCTOR_SHOULD_NORMALIZE ,
862
862
} ) ;
863
863
864
- interface ArithmeticOperationOptions {
865
- roundingMode ?: RoundingMode ;
866
- }
867
-
868
864
interface FullySpecifiedArithmeticOperationOptions {
869
865
roundingMode : RoundingMode ;
870
866
}
@@ -914,25 +910,6 @@ function ensureFullySpecifiedConstructorOptions(
914
910
return opts ;
915
911
}
916
912
917
- function ensureFullySpecifiedArithmeticOperationOptions (
918
- options ?: ArithmeticOperationOptions
919
- ) : FullySpecifiedArithmeticOperationOptions {
920
- let opts = { ...DEFAULT_ARITHMETIC_OPERATION_OPTIONS } ;
921
-
922
- if ( undefined === options ) {
923
- return opts ;
924
- }
925
-
926
- if (
927
- "string" === typeof options . roundingMode &&
928
- ROUNDING_MODES . includes ( options . roundingMode )
929
- ) {
930
- opts . roundingMode = options . roundingMode ;
931
- }
932
-
933
- return opts ;
934
- }
935
-
936
913
function ensureFullySpecifiedToStringOptions (
937
914
options ?: ToStringOptions
938
915
) : FullySpecifiedToStringOptions {
@@ -1294,9 +1271,8 @@ export class Decimal128 {
1294
1271
* Add this Decimal128 value to one or more Decimal128 values.
1295
1272
*
1296
1273
* @param x
1297
- * @param opts
1298
1274
*/
1299
- add ( x : Decimal128 , opts ?: ArithmeticOperationOptions ) : Decimal128 {
1275
+ add ( x : Decimal128 ) : Decimal128 {
1300
1276
if ( this . isNaN || x . isNaN ) {
1301
1277
return new Decimal128 ( NAN ) ;
1302
1278
}
@@ -1318,14 +1294,13 @@ export class Decimal128 {
1318
1294
}
1319
1295
1320
1296
if ( this . isNegative && x . isNegative ) {
1321
- return this . neg ( ) . add ( x . neg ( ) , opts ) . neg ( ) ;
1297
+ return this . neg ( ) . add ( x . neg ( ) ) . neg ( ) ;
1322
1298
}
1323
1299
1324
1300
let resultRat = Rational . add ( this . rat , x . rat ) ;
1325
- let options = ensureFullySpecifiedArithmeticOperationOptions ( opts ) ;
1326
1301
let initialResult = new Decimal128 (
1327
1302
resultRat . toDecimalPlaces ( MAX_SIGNIFICANT_DIGITS + 1 ) ,
1328
- { roundingMode : options . roundingMode }
1303
+ { roundingMode : ROUNDING_MODE_DEFAULT }
1329
1304
) ;
1330
1305
let adjusted = initialResult . setExponent (
1331
1306
Math . min ( this . exponent , x . exponent )
@@ -1338,9 +1313,8 @@ export class Decimal128 {
1338
1313
* Subtract another Decimal128 value from one or more Decimal128 values.
1339
1314
*
1340
1315
* @param x
1341
- * @param opts
1342
1316
*/
1343
- subtract ( x : Decimal128 , opts ?: ArithmeticOperationOptions ) : Decimal128 {
1317
+ subtract ( x : Decimal128 ) : Decimal128 {
1344
1318
if ( this . isNaN || x . isNaN ) {
1345
1319
return new Decimal128 ( NAN ) ;
1346
1320
}
@@ -1369,9 +1343,7 @@ export class Decimal128 {
1369
1343
MAX_SIGNIFICANT_DIGITS + 1
1370
1344
) ;
1371
1345
1372
- let options = ensureFullySpecifiedArithmeticOperationOptions ( opts ) ;
1373
-
1374
- let initialResult = new Decimal128 ( rendered , options ) ;
1346
+ let initialResult = new Decimal128 ( rendered ) ;
1375
1347
let adjusted = initialResult . setExponent (
1376
1348
Math . min ( this . exponent , x . exponent )
1377
1349
) ;
@@ -1384,9 +1356,8 @@ export class Decimal128 {
1384
1356
* If no arguments are given, return this value.
1385
1357
*
1386
1358
* @param x
1387
- * @param opts
1388
1359
*/
1389
- multiply ( x : Decimal128 , opts ?: ArithmeticOperationOptions ) : Decimal128 {
1360
+ multiply ( x : Decimal128 ) : Decimal128 {
1390
1361
if ( this . isNaN || x . isNaN ) {
1391
1362
return new Decimal128 ( NAN ) ;
1392
1363
}
@@ -1425,8 +1396,7 @@ export class Decimal128 {
1425
1396
1426
1397
let resultRat = Rational . multiply ( this . rat , x . rat ) ;
1427
1398
let initialResult = new Decimal128 (
1428
- resultRat . toDecimalPlaces ( MAX_SIGNIFICANT_DIGITS + 1 ) ,
1429
- ensureFullySpecifiedArithmeticOperationOptions ( opts )
1399
+ resultRat . toDecimalPlaces ( MAX_SIGNIFICANT_DIGITS + 1 )
1430
1400
) ;
1431
1401
let adjusted = initialResult . setExponent ( this . exponent + x . exponent ) ;
1432
1402
@@ -1445,9 +1415,8 @@ export class Decimal128 {
1445
1415
* Divide this Decimal128 value by another Decimal128 value.
1446
1416
*
1447
1417
* @param x
1448
- * @param opts
1449
1418
*/
1450
- divide ( x : Decimal128 , opts ?: ArithmeticOperationOptions ) : Decimal128 {
1419
+ divide ( x : Decimal128 ) : Decimal128 {
1451
1420
if ( this . isNaN || x . isNaN ) {
1452
1421
return new Decimal128 ( NAN ) ;
1453
1422
}
@@ -1529,10 +1498,7 @@ export class Decimal128 {
1529
1498
}
1530
1499
1531
1500
let resultExponent = this . exponent - ( x . exponent + adjust ) ;
1532
- return new Decimal128 (
1533
- `${ resultCoefficient } E${ resultExponent } ` ,
1534
- ensureFullySpecifiedArithmeticOperationOptions ( opts )
1535
- ) ;
1501
+ return new Decimal128 ( `${ resultCoefficient } E${ resultExponent } ` ) ;
1536
1502
}
1537
1503
1538
1504
/**
0 commit comments