From 544d29ee25f4cf8adabed2b616e6988266b085e3 Mon Sep 17 00:00:00 2001 From: Michael Mclaughlin Date: Sun, 29 May 2022 23:01:32 +0100 Subject: [PATCH] #277 Resolve lint warnings and add number toString note --- doc/API.html | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/doc/API.html b/doc/API.html index 4517369..bb2b7dd 100644 --- a/doc/API.html +++ b/doc/API.html @@ -195,14 +195,20 @@
is a numeric value in the specified base, or base 10 if base is omitted or is null or undefined.

+

+ Note that the BigNnumber constructor accepts an n of type number purely + as a convenience so that string quotes don't have to be typed when entering literal values, + and that it is the toString value of n that is used rather than its + underlying binary floating point value converted to decimal. +

 x = new BigNumber(123.4567)                // '123.4567'
 // 'new' is optional
 y = BigNumber(x)                           // '123.4567'

- If n is a base 10 value it can be in normal (fixed-point) or - exponential notation. Values in other bases must be in normal notation. Values in any base can - have fraction digits, i.e. digits after the decimal point. + If n is a base 10 value it can be in normal or exponential notation. + Values in other bases must be in normal notation. Values in any base can have fraction digits, + i.e. digits after the decimal point.

 new BigNumber(43210)                       // '43210'
@@ -257,7 +263,7 @@ 

To aid in debugging, if BigNumber.DEBUG is true then an error will be thrown on an invalid n. An error will also be thrown if n is of - type number with more than 15 significant digits, as calling + type number and has more than 15 significant digits, as calling toString or valueOf on these numbers may not result in the intended value.

@@ -325,9 +331,9 @@
configset([object]) ⇒ object20
- The maximum number of decimal places of the results of operations involving - division, i.e. division, square root and base conversion operations, and power - operations with negative exponents.
+ The maximum number of decimal places of the results of operations involving + division, i.e. division, square root and base conversion operations, and power operations + with negative exponents.
BigNumber.config({ DECIMAL_PLACES: 5 })
@@ -1331,7 +1337,7 @@ 
isZero.isZero() ⇒ boolean
 x = new BigNumber(-0)
-x.isZero() && x.isNegative()         // true
+x.isZero() && x.isNegative()         // true
 y = new BigNumber(Infinity)
 y.isZero()                      // false

Note: n == 0 can be used if n >= Number.MIN_VALUE.

@@ -1454,7 +1460,7 @@

If d is omitted or is null or undefined, the return value is the number of significant digits of the value of this BigNumber, or null - if the value of this BigNumber is ±Infinity or NaN.

+ if the value of this BigNumber is ±Infinity or NaN.

If d is true then any trailing zeros of the integer @@ -2158,7 +2164,7 @@

Errors

try { // ... } catch (e) { - if (e instanceof Error && e.message.indexOf('[BigNumber Error]') === 0) { + if (e instanceof Error && e.message.indexOf('[BigNumber Error]') === 0) { // ... } }