Skip to content

Commit 544d29e

Browse files
committed
#277 Resolve lint warnings and add number toString note
1 parent 9a37786 commit 544d29e

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

doc/API.html

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,20 @@ <h5 id="bignumber">
195195
is a numeric value in the specified <code>base</code>, or base <code>10</code> if
196196
<code>base</code> is omitted or is <code>null</code> or <code>undefined</code>.
197197
</p>
198+
<p>
199+
Note that the BigNnumber constructor accepts an <code>n</code> of type <em>number</em> purely
200+
as a convenience so that string quotes don't have to be typed when entering literal values,
201+
and that it is the <code>toString</code> value of <code>n</code> that is used rather than its
202+
underlying binary floating point value converted to decimal.
203+
</p>
198204
<pre>
199205
x = new BigNumber(123.4567) // '123.4567'
200206
// 'new' is optional
201207
y = BigNumber(x) // '123.4567'</pre>
202208
<p>
203-
If <code>n</code> is a base <code>10</code> value it can be in normal (fixed-point) or
204-
exponential notation. Values in other bases must be in normal notation. Values in any base can
205-
have fraction digits, i.e. digits after the decimal point.
209+
If <code>n</code> is a base <code>10</code> value it can be in normal or exponential notation.
210+
Values in other bases must be in normal notation. Values in any base can have fraction digits,
211+
i.e. digits after the decimal point.
206212
</p>
207213
<pre>
208214
new BigNumber(43210) // '43210'
@@ -257,7 +263,7 @@ <h5 id="bignumber">
257263
<p>
258264
To aid in debugging, if <code>BigNumber.DEBUG</code> is <code>true</code> then an error will
259265
be thrown on an invalid <code>n</code>. An error will also be thrown if <code>n</code> is of
260-
type <em>number</em> with more than <code>15</code> significant digits, as calling
266+
type <em>number</em> and has more than <code>15</code> significant digits, as calling
261267
<code><a href='#toS'>toString</a></code> or <code><a href='#valueOf'>valueOf</a></code> on
262268
these numbers may not result in the intended value.
263269
</p>
@@ -325,9 +331,9 @@ <h5 id="config">config<code class='inset'>set([object]) <i>&rArr; object</i></co
325331
Default value: <code>20</code>
326332
</dd>
327333
<dd>
328-
The <u>maximum</u> number of decimal places of the results of operations involving
329-
division, i.e. division, square root and base conversion operations, and power
330-
operations with negative exponents.<br />
334+
The <em>maximum</em> number of decimal places of the results of operations involving
335+
division, i.e. division, square root and base conversion operations, and power operations
336+
with negative exponents.<br />
331337
</dd>
332338
<dd>
333339
<pre>BigNumber.config({ DECIMAL_PLACES: 5 })
@@ -1331,7 +1337,7 @@ <h5 id="isZ">isZero<code class='inset'>.isZero() <i>&rArr; boolean</i></code></h
13311337
</p>
13321338
<pre>
13331339
x = new BigNumber(-0)
1334-
x.isZero() && x.isNegative() // true
1340+
x.isZero() &amp;&amp; x.isNegative() // true
13351341
y = new BigNumber(Infinity)
13361342
y.isZero() // false</pre>
13371343
<p>Note: <code>n == 0</code> can be used if <code>n &gt;= Number.MIN_VALUE</code>.</p>
@@ -1454,7 +1460,7 @@ <h5 id="sd">
14541460
<p>
14551461
If <code>d</code> is omitted or is <code>null</code> or <code>undefined</code>, the return
14561462
value is the number of significant digits of the value of this BigNumber, or <code>null</code>
1457-
if the value of this BigNumber is &plusmn;<code>Infinity</code> or <code>NaN</code>.</p>
1463+
if the value of this BigNumber is &plusmn;<code>Infinity</code> or <code>NaN</code>.
14581464
</p>
14591465
<p>
14601466
If <code>d</code> is <code>true</code> then any trailing zeros of the integer
@@ -2158,7 +2164,7 @@ <h4 id='Errors'>Errors</h4>
21582164
try {
21592165
// ...
21602166
} catch (e) {
2161-
if (e instanceof Error && e.message.indexOf('[BigNumber Error]') === 0) {
2167+
if (e instanceof Error &amp;&amp; e.message.indexOf('[BigNumber Error]') === 0) {
21622168
// ...
21632169
}
21642170
}</pre>

0 commit comments

Comments
 (0)