Skip to content

Commit 8d9e5f7

Browse files
committed
Add missing documentation of toFixed etc. rounding mode parameter
1 parent cd8a47f commit 8d9e5f7

File tree

1 file changed

+49
-14
lines changed

1 file changed

+49
-14
lines changed

docs/index.html

Lines changed: 49 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757

5858
<a class='nav-title' href="#">API</a>
5959
<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>
6162
<option value="legacy/v5.2.x.html">v5.2.x</option>
6263
<option value="legacy/v5.1.x.html">v5.1.x</option>
6364
<option value="legacy/v5.0.x.html">v5.0.x</option>
@@ -81,6 +82,11 @@
8182
<li><a href="#eneg" >NE</a></li>
8283
<li><a href="#epos" >PE</a></li>
8384
<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+
8490
</ul>
8591

8692
<b> INSTANCE </b>
@@ -229,19 +235,21 @@ <h5 id="rm">RM</h5>
229235
Default value: <code>1</code>
230236
</p>
231237
<p>
232-
The rounding mode used in the above operations and by
238+
The rounding mode used in operations involving division and by
233239
<a href='#round'><code>round</code></a>,
234240
<a href='#toE'><code>toExponential</code></a>,
235241
<a href='#toF'><code>toFixed</code></a> and
236242
<a href='#toP'><code>toPrecision</code></a>.
237243
</p>
238244
<table>
239245
<tr>
246+
<th>Property</th>
240247
<th>Value</th>
241248
<th>Description</th>
242249
<th>BigDecimal equivalent</th>
243250
</tr>
244251
<tr>
252+
<td>Big.roundUp</td>
245253
<td class='centre'>0</td>
246254
<td>
247255
Rounds towards zero.<br />
@@ -250,6 +258,7 @@ <h5 id="rm">RM</h5>
250258
<td id="round-down">ROUND_DOWN</td>
251259
</tr>
252260
<tr>
261+
<td>Big.roundHalfUp</td>
253262
<td class='centre'>1</td>
254263
<td>
255264
Rounds towards nearest neighbour.<br />
@@ -258,6 +267,7 @@ <h5 id="rm">RM</h5>
258267
<td id="round-half-up">ROUND_HALF_UP</td>
259268
</tr>
260269
<tr>
270+
<td>Big.roundHalfEven</td>
261271
<td class='centre'>2</td>
262272
<td>
263273
Rounds towards nearest neighbour.<br />
@@ -266,6 +276,7 @@ <h5 id="rm">RM</h5>
266276
<td id="round-half-even">ROUND_HALF_EVEN</td>
267277
</tr>
268278
<tr>
279+
<td>Big.roundDown</td>
269280
<td class='centre'>3</td>
270281
<td>Rounds away from zero.</td>
271282
<td id="round-up">ROUND_UP</td>
@@ -275,7 +286,9 @@ <h5 id="rm">RM</h5>
275286
The value will be checked for validity when one of the above methods is
276287
called.<br /> An error will be thrown if the value is found to be invalid.
277288
</p>
278-
<pre>Big.RM = 0</pre>
289+
<pre>
290+
Big.RM = 0
291+
Big.RM = Big.roundUp</pre>
279292

280293

281294

@@ -729,10 +742,14 @@ <h5 id="times">
729742

730743

731744
<h5 id="toE">
732-
toExponential<code class='inset'>.toExponential(dp) &rArr;
745+
toExponential<code class='inset'>.toExponential(dp, rm) &rArr;
733746
<i>string</i></code>
734747
</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>
736753
<p>
737754
Returns a string representing the value of this Big number in exponential
738755
notation to a fixed number of <code>dp</code> decimal places.
@@ -741,7 +758,7 @@ <h5 id="toE">
741758
If the value of this Big number in exponential notation has more digits to
742759
the right of the decimal point than is specified by <code>dp</code>, the
743760
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>.
745762
</p>
746763
<p>
747764
If the value of this Big number in exponential notation has fewer digits
@@ -754,7 +771,11 @@ <h5 id="toE">
754771
necessary to represent the value exactly.
755772
</p>
756773
<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.
758779
</p>
759780
<pre>
760781
x = 45.6
@@ -771,11 +792,13 @@ <h5 id="toE">
771792

772793

773794
<h5 id="toF">
774-
toFixed<code class='inset'>.toFixed(dp) &rArr;
795+
toFixed<code class='inset'>.toFixed(dp, rm) &rArr;
775796
<i>string</i></code>
776797
</h5>
777798
<p>
778799
<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
779802
</p>
780803
<p>
781804
Returns a string representing the value of this Big number in normal
@@ -785,7 +808,7 @@ <h5 id="toF">
785808
If the value of this Big number in normal notation has more digits to the
786809
right of the decimal point than is specified by <code>dp</code>, the
787810
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>.
789812
</p>
790813
<p>
791814
If the value of this Big number in normal notation has fewer fraction
@@ -804,7 +827,11 @@ <h5 id="toF">
804827
decimal places.
805828
</p>
806829
<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.
808835
</p>
809836
<pre>
810837
x = 45.6
@@ -833,10 +860,14 @@ <h5 id="toJSON">
833860

834861

835862
<h5 id="toP">
836-
toPrecision<code class='inset'>.toPrecision(sd) &rArr;
863+
toPrecision<code class='inset'>.toPrecision(sd, rm) &rArr;
837864
<i>string</i></code>
838865
</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>
840871
<p>
841872
Returns a string representing the value of this Big number to the
842873
specified number of <code>sd</code> significant digits.
@@ -845,7 +876,7 @@ <h5 id="toP">
845876
If the value of this Big number has more digits than is specified by
846877
<code>sd</code>, the return value will be rounded to <code>sd</code>
847878
significant digits using rounding mode
848-
<a href='#rm'><code>Big.RM</code></a>.
879+
<a href='#rm'><code>rm</code></a>.
849880
</p>
850881
<p>
851882
If the value of this Big number has fewer digits than is specified by
@@ -861,7 +892,11 @@ <h5 id="toP">
861892
the same as <code>.toString()</code>.
862893
</p>
863894
<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.
865900
</p>
866901
<pre>
867902
x = 45.6

0 commit comments

Comments
 (0)