Skip to content

Commit f8ad6c9

Browse files
committed
Add note that a Big is created from a numbers toString value
1 parent 1ef0018 commit f8ad6c9

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

docs/index.html

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ <h1>big.js</h1>
151151
<h2>API</h2>
152152

153153
<p>
154-
In all examples below, <code>var</code> and semicolons are not shown, and
155-
if a commented-out value is in quotes it means <code>toString</code> has
156-
been called on the preceding expression.
154+
For brevity, <code>var</code>, semicolons and <code>toString</code> calls
155+
have been omitted in the examples below.
157156
</p>
158157

159158

@@ -169,6 +168,12 @@ <h5 id="big">
169168
but if <a href='#strict'><code>Big.strict</code></a> is set to <code>true</code>
170169
an error will be thrown if <code>n</code> is not a string or Big number.
171170
</p>
171+
<p>
172+
Note that primitive numbers are accepted purely as a convenience so that quotes
173+
don't need to be typed for numeric literals of up to 15 significant digits, and
174+
that a Big number is created from a number's <code>toString</code> value rather
175+
than from its underlying binary floating point value.
176+
</p>
172177
<p>
173178
<code>Infinity</code>, <code>NaN</code> and hexadecimal literal
174179
strings, e.g. '0xff', are <u>not</u> valid.
@@ -178,21 +183,20 @@ <h5 id="big">
178183
e.g. '011' is 11, not 9.
179184
</p>
180185
<p>
181-
String values may be in exponential, as well as normal (non-exponential)
182-
notation.
186+
String values may be in exponential, as well as normal notation.
183187
</p>
184188
<p>
185189
There is no limit to the number of digits of a <em>string</em> value
186190
(other than that of JavaScript's maximum array size), but the largest
187191
recommended exponent magnitude is 1000000.
188192
</p>
189-
<p>Returns a new Big number object with value <code>n</code>.</p>
193+
<p>Returns a new Big number with value <code>n</code>.</p>
190194
<p>Throws if <code>n</code> is invalid.</p>
191195
<p>
192196
Using <code>new</code> with Big is optional, but note that if no argument
193197
is passed when doing so, or if the argument is <code>undefined</code>,
194-
then a new Big constructor will be returned rather than a new Big number
195-
instance. See <a href='#multiple'>creating additional Big number constructors</a>
198+
then a new Big constructor will be returned rather than a new Big number.
199+
See <a href='#multiple'>creating additional Big number constructors</a>
196200
below.
197201
</p>
198202
<pre>

0 commit comments

Comments
 (0)