+ | Big.roundDown |
3 |
Rounds away from zero. |
ROUND_UP |
@@ -275,7 +286,9 @@ Big() // No error, and a new Big constructor is r
The value will be checked for validity when one of the above methods is
called.
An error will be thrown if the value is found to be invalid.
- Big.RM = 0
+
+Big.RM = 0
+Big.RM = Big.roundUp
@@ -729,10 +742,14 @@ Big('7e+500').times(y) // '1.26e+501'
- toExponential.toExponential(dp) ⇒
+ toExponential.toExponential(dp, rm) ⇒
string
- dp? : number : integer, 0 to 1e+6 inclusive
+
+ dp? : number : integer, 0 to 1e+6 inclusive
+
+ rm? : number : 0, 1, 2 or 3
+
Returns a string representing the value of this Big number in exponential
notation to a fixed number of dp decimal places.
@@ -741,7 +758,7 @@ Big('7e+500').times(y) // '1.26e+501'
If the value of this Big number in exponential notation has more digits to
the right of the decimal point than is specified by dp, the
return value will be rounded to dp decimal places using
- rounding mode Big.RM.
+ rounding mode rm.
If the value of this Big number in exponential notation has fewer digits
@@ -754,7 +771,11 @@ Big('7e+500').times(y) // '1.26e+501'
necessary to represent the value exactly.
- Throws if dp is invalid.
+ if rm is omitted or is undefined, the current
+ Big.RM setting is used.
+
+
+ Throws if dp or rm is invalid.
x = 45.6
@@ -771,11 +792,13 @@ y.toExponential(3) // '4.560e+1'
- toFixed.toFixed(dp) ⇒
+ toFixed.toFixed(dp, rm) ⇒
string
dp? : number : integer, 0 to 1e+6 inclusive
+
+ rm? : number : 0, 1, 2 or 3
Returns a string representing the value of this Big number in normal
@@ -785,7 +808,7 @@ y.toExponential(3) // '4.560e+1'
If the value of this Big number in normal notation has more digits to the
right of the decimal point than is specified by dp, the
return value will be rounded to dp decimal places using
- rounding mode Big.RM.
+ rounding mode rm.
If the value of this Big number in normal notation has fewer fraction
@@ -804,7 +827,11 @@ y.toExponential(3) // '4.560e+1'
decimal places.
- Throws if dp is invalid.
+ if rm is omitted or is undefined, the current
+ Big.RM setting is used.
+
+
+ Throws if dp or rm is invalid.
x = 45.6
@@ -833,10 +860,14 @@ JSON.parse(str, function (k, v) { return k === '' ? v : new Big(v) })
- toPrecision.toPrecision(sd) ⇒
+ toPrecision.toPrecision(sd, rm) ⇒
string
- sd? : number : integer, 1 to 1e+6 inclusive
+
+ sd? : number : integer, 1 to 1e+6 inclusive
+
+ rm? : number : 0, 1, 2 or 3
+
Returns a string representing the value of this Big number to the
specified number of sd significant digits.
@@ -845,7 +876,7 @@ JSON.parse(str, function (k, v) { return k === '' ? v : new Big(v) })
If the value of this Big number has more digits than is specified by
sd, the return value will be rounded to sd
significant digits using rounding mode
- Big.RM.
+ rm.
If the value of this Big number has fewer digits than is specified by
@@ -861,7 +892,11 @@ JSON.parse(str, function (k, v) { return k === '' ? v : new Big(v) })
the same as .toString().
- Throws if sd is invalid.
+ if rm is omitted or is undefined, the current
+ Big.RM setting is used.
+
+
+ Throws if sd or rm is invalid.
x = 45.6