@@ -11,64 +11,36 @@ let zeroPointSix = new Decimal128("0.6");
11
11
let onePointFive = new Decimal128 ( "1.5" ) ;
12
12
13
13
// ceiling
14
- "-1" === minusOnePointFive . round ( 0 , "ceil " ) . toString ( ) ;
15
- "1" === zeroPointFour . round ( 0 , "ceil " ) . toString ( ) ;
16
- "1" === zeroPointFive . round ( 0 , "ceil " ) . toString ( ) ;
17
- "1" === zeroPointSix . round ( 0 , "ceil " ) . toString ( ) ;
18
- "2" === onePointFive . round ( 0 , "ceil " ) . toString ( ) ;
14
+ "-1" === minusOnePointFive . round ( 0 , "roundTowardPositive " ) . toString ( ) ;
15
+ "1" === zeroPointFour . round ( 0 , "roundTowardPositive " ) . toString ( ) ;
16
+ "1" === zeroPointFive . round ( 0 , "roundTowardPositive " ) . toString ( ) ;
17
+ "1" === zeroPointSix . round ( 0 , "roundTowardPositive " ) . toString ( ) ;
18
+ "2" === onePointFive . round ( 0 , "roundTowardPositive " ) . toString ( ) ;
19
19
20
20
// floor
21
- "-2" === minusOnePointFive . round ( 0 , "floor" ) . toString ( ) ;
22
- "0" === zeroPointFour . round ( 0 , "floor" ) . toString ( ) ;
23
- "0" === zeroPointFive . round ( 0 , "floor" ) . toString ( ) ;
24
- "0" === zeroPointSix . round ( 0 , "floor" ) . toString ( ) ;
25
- "1" === onePointFive . round ( 0 , "floor" ) . toString ( ) ;
26
-
27
- // expand
28
- "-2" === minusOnePointFive . round ( 0 , "expand" ) . toString ( ) ;
29
- "1" === zeroPointFour . round ( 0 , "expand" ) . toString ( ) ;
30
- "1" === zeroPointFive . round ( 0 , "expand" ) . toString ( ) ;
31
- "1" === zeroPointSix . round ( 0 , "expand" ) . toString ( ) ;
32
- "2" === onePointFive . round ( 0 , "expand" ) . toString ( ) ;
21
+ "-2" === minusOnePointFive . round ( 0 , "roundTowardNegative" ) . toString ( ) ;
22
+ "0" === zeroPointFour . round ( 0 , "roundTowardNegative" ) . toString ( ) ;
23
+ "0" === zeroPointFive . round ( 0 , "roundTowardNegative" ) . toString ( ) ;
24
+ "0" === zeroPointSix . round ( 0 , "roundTowardNegative" ) . toString ( ) ;
25
+ "1" === onePointFive . round ( 0 , "roundTowardNegative" ) . toString ( ) ;
33
26
34
27
// truncate
35
- "-1" === minusOnePointFive . round ( 0 , "trunc" ) . toString ( ) ;
36
- "0" === zeroPointFour . round ( 0 , "trunc" ) . toString ( ) ;
37
- "0" === zeroPointFive . round ( 0 , "trunc" ) . toString ( ) ;
38
- "0" === zeroPointSix . round ( 0 , "trunc" ) . toString ( ) ;
39
- "1" === onePointFive . round ( 0 , "trunc" ) . toString ( ) ;
40
-
41
- // round ties to ceiling
42
- "-1" === minusOnePointFive . round ( 0 , "halfCeil" ) . toString ( ) ;
43
- "0" === zeroPointFour . round ( 0 , "halfCeil" ) . toString ( ) ;
44
- "1" === zeroPointFive . round ( 0 , "halfCeil" ) . toString ( ) ;
45
- "1" === zeroPointSix . round ( 0 , "halfCeil" ) . toString ( ) ;
46
- "2" === onePointFive . round ( 0 , "halfCeil" ) . toString ( ) ;
47
-
48
- // round ties to floor
49
- "-2" === minusOnePointFive . round ( 0 , "halfFloor" ) . toString ( ) ;
50
- "0" === zeroPointFour . round ( 0 , "halfFloor" ) . toString ( ) ;
51
- "0" === zeroPointFive . round ( 0 , "halfFloor" ) . toString ( ) ;
52
- "1" === zeroPointSix . round ( 0 , "halfFloor" ) . toString ( ) ;
53
- "1" === onePointFive . round ( 0 , "halfFloor" ) . toString ( ) ;
28
+ "-1" === minusOnePointFive . round ( 0 , "roundTowardZero" ) . toString ( ) ;
29
+ "0" === zeroPointFour . round ( 0 , "roundTowardZero" ) . toString ( ) ;
30
+ "0" === zeroPointFive . round ( 0 , "roundTowardZero" ) . toString ( ) ;
31
+ "0" === zeroPointSix . round ( 0 , "roundTowardZero" ) . toString ( ) ;
32
+ "1" === onePointFive . round ( 0 , "roundTowardZero" ) . toString ( ) ;
54
33
55
34
// round ties away from zero
56
- "-2" === minusOnePointFive . round ( 0 , "halfExpand" ) . toString ( ) ;
57
- "0" === zeroPointFour . round ( 0 , "halfExpand" ) . toString ( ) ;
58
- "1" === zeroPointFive . round ( 0 , "halfExpand" ) . toString ( ) ;
59
- "1" === zeroPointSix . round ( 0 , "halfExpand" ) . toString ( ) ;
60
- "2" === onePointFive . round ( 0 , "halfExpand" ) . toString ( ) ;
61
-
62
- // round ties to toward zero
63
- "-1" === minusOnePointFive . round ( 0 , "halfTrunc" ) . toString ( ) ;
64
- "0" === zeroPointFour . round ( 0 , "halfTrunc" ) . toString ( ) ;
65
- "0" === zeroPointFive . round ( 0 , "halfTrunc" ) . toString ( ) ;
66
- "1" === zeroPointSix . round ( 0 , "halfTrunc" ) . toString ( ) ;
67
- "1" === onePointFive . round ( 0 , "halfTrunc" ) . toString ( ) ;
35
+ "-2" === minusOnePointFive . round ( 0 , "roundTiesToAway" ) . toString ( ) ;
36
+ "0" === zeroPointFour . round ( 0 , "roundTiesToAway" ) . toString ( ) ;
37
+ "1" === zeroPointFive . round ( 0 , "roundTiesToAway" ) . toString ( ) ;
38
+ "1" === zeroPointSix . round ( 0 , "roundTiesToAway" ) . toString ( ) ;
39
+ "2" === onePointFive . round ( 0 , "roundTiesToAway" ) . toString ( ) ;
68
40
69
41
// round ties to even
70
- "-2" === minusOnePointFive . round ( 0 , "halfEven " ) . toString ( ) ;
71
- "0" === zeroPointFour . round ( 0 , "halfEven " ) . toString ( ) ;
72
- "0" === zeroPointFive . round ( 0 , "halfEven " ) . toString ( ) ;
73
- "1" === zeroPointSix . round ( 0 , "halfEven " ) . toString ( ) ;
74
- "2" === onePointFive . round ( 0 , "halfEven " ) . toString ( ) ;
42
+ "-2" === minusOnePointFive . round ( 0 , "roundTiesToEven " ) . toString ( ) ;
43
+ "0" === zeroPointFour . round ( 0 , "roundTiesToEven " ) . toString ( ) ;
44
+ "0" === zeroPointFive . round ( 0 , "roundTiesToEven " ) . toString ( ) ;
45
+ "1" === zeroPointSix . round ( 0 , "roundTiesToEven " ) . toString ( ) ;
46
+ "2" === onePointFive . round ( 0 , "roundTiesToEven " ) . toString ( ) ;
0 commit comments