57
57
58
58
< a class ='nav-title ' href ="# "> API</ a >
59
59
< select id ="version " name ="version " onchange ="location.href=this.value;this.selectedIndex=0 ">
60
- < option value ="" selected > v6.0.x</ option >
60
+ < option value ="" selected > v6.1.x</ option >
61
+ < option value ="legacy/v6.0.x.html "> v6.0.x</ option >
61
62
< option value ="legacy/v5.2.x.html "> v5.2.x</ option >
62
63
< option value ="legacy/v5.1.x.html "> v5.1.x</ option >
63
64
< option value ="legacy/v5.0.x.html "> v5.0.x</ option >
81
82
< li > < a href ="#eneg " > NE</ a > </ li >
82
83
< li > < a href ="#epos " > PE</ a > </ li >
83
84
< li > < a href ="#strict "> strict</ a > </ li >
85
+ < li > < a href ="#rm " > roundDown</ a > </ li >
86
+ < li > < a href ="#rm " > roundHalfUp</ a > </ li >
87
+ < li > < a href ="#rm " > roundHalfEven</ a > </ li >
88
+ < li > < a href ="#rm " > roundUp</ a > </ li >
89
+
84
90
</ ul >
85
91
86
92
< b > INSTANCE </ b >
@@ -229,19 +235,21 @@ <h5 id="rm">RM</h5>
229
235
Default value: < code > 1</ code >
230
236
</ p >
231
237
< p >
232
- The rounding mode used in the above operations and by
238
+ The rounding mode used in operations involving division and by
233
239
< a href ='#round '> < code > round</ code > </ a > ,
234
240
< a href ='#toE '> < code > toExponential</ code > </ a > ,
235
241
< a href ='#toF '> < code > toFixed</ code > </ a > and
236
242
< a href ='#toP '> < code > toPrecision</ code > </ a > .
237
243
</ p >
238
244
< table >
239
245
< tr >
246
+ < th > Property</ th >
240
247
< th > Value</ th >
241
248
< th > Description</ th >
242
249
< th > BigDecimal equivalent</ th >
243
250
</ tr >
244
251
< tr >
252
+ < td > Big.roundUp</ td >
245
253
< td class ='centre '> 0</ td >
246
254
< td >
247
255
Rounds towards zero.< br />
@@ -250,6 +258,7 @@ <h5 id="rm">RM</h5>
250
258
< td id ="round-down "> ROUND_DOWN</ td >
251
259
</ tr >
252
260
< tr >
261
+ < td > Big.roundHalfUp</ td >
253
262
< td class ='centre '> 1</ td >
254
263
< td >
255
264
Rounds towards nearest neighbour.< br />
@@ -258,6 +267,7 @@ <h5 id="rm">RM</h5>
258
267
< td id ="round-half-up "> ROUND_HALF_UP</ td >
259
268
</ tr >
260
269
< tr >
270
+ < td > Big.roundHalfEven</ td >
261
271
< td class ='centre '> 2</ td >
262
272
< td >
263
273
Rounds towards nearest neighbour.< br />
@@ -266,6 +276,7 @@ <h5 id="rm">RM</h5>
266
276
< td id ="round-half-even "> ROUND_HALF_EVEN</ td >
267
277
</ tr >
268
278
< tr >
279
+ < td > Big.roundDown</ td >
269
280
< td class ='centre '> 3</ td >
270
281
< td > Rounds away from zero.</ td >
271
282
< td id ="round-up "> ROUND_UP</ td >
@@ -275,7 +286,9 @@ <h5 id="rm">RM</h5>
275
286
The value will be checked for validity when one of the above methods is
276
287
called.< br /> An error will be thrown if the value is found to be invalid.
277
288
</ p >
278
- < pre > Big.RM = 0</ pre >
289
+ < pre >
290
+ Big.RM = 0
291
+ Big.RM = Big.roundUp</ pre >
279
292
280
293
281
294
@@ -729,10 +742,14 @@ <h5 id="times">
729
742
730
743
731
744
< h5 id ="toE ">
732
- toExponential< code class ='inset '> .toExponential(dp) ⇒
745
+ toExponential< code class ='inset '> .toExponential(dp, rm ) ⇒
733
746
< i > string</ i > </ code >
734
747
</ h5 >
735
- < p > < code > dp</ code > ? : < i > number</ i > : integer, 0 to 1e+6 inclusive</ p >
748
+ < p >
749
+ < code > dp</ code > ? : < i > number</ i > : integer, 0 to 1e+6 inclusive
750
+ < br />
751
+ < code > rm</ code > ? : < i > number</ i > : 0, 1, 2 or 3
752
+ </ p >
736
753
< p >
737
754
Returns a string representing the value of this Big number in exponential
738
755
notation to a fixed number of < code > dp</ code > decimal places.
@@ -741,7 +758,7 @@ <h5 id="toE">
741
758
If the value of this Big number in exponential notation has more digits to
742
759
the right of the decimal point than is specified by < code > dp</ code > , the
743
760
return value will be rounded to < code > dp</ code > decimal places using
744
- rounding mode < a href ='#rm '> < code > Big.RM </ code > </ a > .
761
+ rounding mode < a href ='#rm '> < code > rm </ code > </ a > .
745
762
</ p >
746
763
< p >
747
764
If the value of this Big number in exponential notation has fewer digits
@@ -754,7 +771,11 @@ <h5 id="toE">
754
771
necessary to represent the value exactly.
755
772
</ p >
756
773
< p >
757
- Throws if < code > dp</ code > is invalid.
774
+ if < code > rm</ code > is omitted or is undefined, the current
775
+ < a href ='#rm '> < code > Big.RM</ code > </ a > setting is used.
776
+ </ p >
777
+ < p >
778
+ Throws if < code > dp</ code > or < code > rm</ code > is invalid.
758
779
</ p >
759
780
< pre >
760
781
x = 45.6
@@ -771,11 +792,13 @@ <h5 id="toE">
771
792
772
793
773
794
< h5 id ="toF ">
774
- toFixed< code class ='inset '> .toFixed(dp) ⇒
795
+ toFixed< code class ='inset '> .toFixed(dp, rm ) ⇒
775
796
< i > string</ i > </ code >
776
797
</ h5 >
777
798
< p >
778
799
< code > dp</ code > ? : < i > number</ i > : integer, 0 to 1e+6 inclusive
800
+ < br />
801
+ < code > rm</ code > ? : < i > number</ i > : 0, 1, 2 or 3
779
802
</ p >
780
803
< p >
781
804
Returns a string representing the value of this Big number in normal
@@ -785,7 +808,7 @@ <h5 id="toF">
785
808
If the value of this Big number in normal notation has more digits to the
786
809
right of the decimal point than is specified by < code > dp</ code > , the
787
810
return value will be rounded to < code > dp</ code > decimal places using
788
- rounding mode < a href ='#rm '> < code > Big.RM </ code > </ a > .
811
+ rounding mode < a href ='#rm '> < code > rm </ code > </ a > .
789
812
</ p >
790
813
< p >
791
814
If the value of this Big number in normal notation has fewer fraction
@@ -804,7 +827,11 @@ <h5 id="toF">
804
827
decimal places.
805
828
</ p >
806
829
< p >
807
- Throws if < code > dp</ code > is invalid.
830
+ if < code > rm</ code > is omitted or is undefined, the current
831
+ < a href ='#rm '> < code > Big.RM</ code > </ a > setting is used.
832
+ </ p >
833
+ < p >
834
+ Throws if < code > dp</ code > or < code > rm</ code > is invalid.
808
835
</ p >
809
836
< pre >
810
837
x = 45.6
@@ -833,10 +860,14 @@ <h5 id="toJSON">
833
860
834
861
835
862
< h5 id ="toP ">
836
- toPrecision< code class ='inset '> .toPrecision(sd) ⇒
863
+ toPrecision< code class ='inset '> .toPrecision(sd, rm ) ⇒
837
864
< i > string</ i > </ code >
838
865
</ h5 >
839
- < p > < code > sd</ code > ? : < i > number</ i > : integer, 1 to 1e+6 inclusive</ p >
866
+ < p >
867
+ < code > sd</ code > ? : < i > number</ i > : integer, 1 to 1e+6 inclusive
868
+ < br />
869
+ < code > rm</ code > ? : < i > number</ i > : 0, 1, 2 or 3
870
+ </ p >
840
871
< p >
841
872
Returns a string representing the value of this Big number to the
842
873
specified number of < code > sd</ code > significant digits.
@@ -845,7 +876,7 @@ <h5 id="toP">
845
876
If the value of this Big number has more digits than is specified by
846
877
< code > sd</ code > , the return value will be rounded to < code > sd</ code >
847
878
significant digits using rounding mode
848
- < a href ='#rm '> < code > Big.RM </ code > </ a > .
879
+ < a href ='#rm '> < code > rm </ code > </ a > .
849
880
</ p >
850
881
< p >
851
882
If the value of this Big number has fewer digits than is specified by
@@ -861,7 +892,11 @@ <h5 id="toP">
861
892
the same as < code > .toString()</ code > .
862
893
</ p >
863
894
< p >
864
- Throws if < code > sd</ code > is invalid.
895
+ if < code > rm</ code > is omitted or is undefined, the current
896
+ < a href ='#rm '> < code > Big.RM</ code > </ a > setting is used.
897
+ </ p >
898
+ < p >
899
+ Throws if < code > sd</ code > or < code > rm</ code > is invalid.
865
900
</ p >
866
901
< pre >
867
902
x = 45.6
0 commit comments