]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Document tonumber() enhancements.
authorMike Pall <mike>
Sun, 28 Oct 2012 13:20:14 +0000 (14:20 +0100)
committerMike Pall <mike>
Sun, 28 Oct 2012 13:20:14 +0000 (14:20 +0100)
doc/extensions.html

index 0679921ac39119560c05a59358da5cf33d123b0a..d32dd37c54ee4c82494f9d3170b3ee774da08889 100644 (file)
@@ -170,6 +170,17 @@ positive infinity results in <tt>"inf"</tt> and negative infinity results
 in <tt>"-inf"</tt>.
 </p>
 
+<h3 id="tonumber"><tt>tonumber()</tt> etc. use builtin string to number conversion</h3>
+<p>
+All string-to-number conversions consistently convert integer and
+floating-point inputs in decimal and hexadecimal on all platforms.
+<tt>strtod()</tt> is <em>not</em> used anymore, which avoids numerous
+problems with poor C library implementations. The builtin conversion
+function provides full precision according to the IEEE-754 standard, it
+works independently of the current locale and it supports hex floating-point
+numbers (e.g. <tt>0x1.5p-3</tt>).
+</p>
+
 <h3 id="string_dump"><tt>string.dump(f [,strip])</tt> generates portable bytecode</h3>
 <p>
 An extra argument has been added to <tt>string.dump()</tt>. If set to
@@ -198,7 +209,7 @@ implementation which uses the platform-specific ANSI rand().
 The PRNG generates the same sequences from the same seeds on all
 platforms and makes use of all bits in the seed argument.
 <tt>math.random()</tt> without arguments generates 52 pseudo-random bits
-for every call. The result is uniformly distributed between 0 and 1.
+for every call. The result is uniformly distributed between 0.0 and 1.0.
 It's correctly scaled up and rounded for <tt>math.random(n&nbsp;[,m])</tt> to
 preserve uniformity.
 </p>