[html5] r2731 - [] (0) Floats: Allow '1e+0' syntax. Require it for serialising floating point nu [...]

whatwg at whatwg.org whatwg at whatwg.org
Sun Feb 1 00:31:03 PST 2009


Author: ianh
Date: 2009-02-01 00:31:02 -0800 (Sun, 01 Feb 2009)
New Revision: 2731

Modified:
   index
   source
Log:
[] (0) Floats: Allow '1e+0' syntax. Require it for serialising floating point numbers. Other editorial fixes.

Modified: index
===================================================================
--- index	2009-02-01 05:23:43 UTC (rev 2730)
+++ index	2009-02-01 08:31:02 UTC (rev 2731)
@@ -2276,7 +2276,8 @@
     <ol><li>Either a U+0065 LATIN SMALL LETTER E character or a U+0045
      LATIN CAPITAL LETTER E character.</li>
 
-     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.</li>
+     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character or U+002B
+     PLUS SIGN ("+") character.</li>
 
      <li>A series of characters in the range U+0030 DIGIT ZERO (0) to
      U+0039 DIGIT NINE (9).</li>
@@ -2292,9 +2293,18 @@
   HYPHEN-MINUS ("-") character and the number is not zero), and where
   the exponent is the number after the E, if any (interpreted as a
   negative number if there is a U+002D HYPHEN-MINUS ("-") character
-  between the E and the number and the number is not zero). If there
-  is no E, then the exponent is treated as zero.</p>
+  between the E and the number and the number is not zero, or else
+  ignoring a U+002B PLUS SIGN ("+") character between the E and the
+  number if there is one). If there is no E, then the exponent is
+  treated as zero.</p>
 
+  <p class=note>The values ±Infinity and NaN are not <a href=#valid-floating-point-number title="valid floating point number">valid floating point
+  numbers</a>.</p>
+
+  <p>The <dfn id=best-representation-of-the-floating-point-number>best representation of the floating point number</dfn>
+  <var title="">n</var> is the string obtained from applying the
+  ECMAScript operator ToString to <var title="">n</var>.</p>
+
   <p>The <dfn id=rules-for-parsing-floating-point-number-values>rules for parsing floating point number values</dfn> are
   as given in the following algorithm. As with the previous
   algorithms, when this one is invoked, the steps must be followed in
@@ -2396,6 +2406,14 @@
 
        <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then return <var title="">value</var>.</li>
 
+      </ol><p>Otherwise, if the character indicated by <var title="">position</var> is a U+002B PLUS SIGN ("+")
+      character:</p>
+
+      <ol><li>Advance <var title="">position</var> to the next
+       character.</li>
+
+       <li><p>If <var title="">position</var> is past the end of <var title="">input</var>, then return <var title="">value</var>.</li>
+
       </ol></li>
 
      <li><p>If the character indicated by <var title="">position</var>
@@ -4036,7 +4054,7 @@
     the element</i>, as defined by the XML Base specification, with
     <i>the base URI of the document entity</i> being defined as the
     <a href=#document-base-url>document base URL</a> of the <code>Document</code> that
-    owns the element.</p>
+    owns the element. <a href=#refsXMLBASE>[XMLBASE]</a></p>
 
     <p>For the purposes of the XML Base specification, user agents
     must act as if all <code>Document</code> objects represented XML
@@ -5263,11 +5281,13 @@
   returned. If, on the other hand, it fails or returns an out of range
   value, or if the attribute is absent, the default value must be
   returned instead, or 0.0 if there is no default value. On setting,
-  the given value must be converted to the shortest possible string
-  representing the number as a <a href=#valid-floating-point-number>valid floating point
-  number</a> in base ten and then that string must be used as the
-  new content attribute value.</p>
+  the given value must be converted to the <a href=#best-representation-of-the-floating-point-number>best representation
+  of the floating point number</a> and then that string must be
+  used as the new content attribute value.</p>
 
+  <p class=note>The values ±Infinity and NaN throw an
+  exception on setting, as defined by WebIDL. <a href=#refsWEBIDL>[WEBIDL]</a></p>
+
   <p>If a reflecting DOM attribute is of the type
   <code><a href=#domtokenlist-0>DOMTokenList</a></code>, then on getting it must return a
   <code><a href=#domtokenlist-0>DOMTokenList</a></code> object whose underlying string is the
@@ -26458,9 +26478,9 @@
   number values</a> to it. User agents must not allow the user to
   set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that
   is not a <a href=#valid-floating-point-number>valid floating point number</a>. If the user agent
-  provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#valid-floating-point-number>valid
-  floating point number</a> representing the user's selection. User
-  agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+  provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to the <a href=#best-representation-of-the-floating-point-number>best
+  representation of the floating point number</a> representing the
+  user's selection. User agents should allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
 
   <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
   specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point
@@ -26572,9 +26592,10 @@
   number values</a> to it. User agents must not allow the user to
   set the <a href=#concept-fe-value title=concept-fe-value>value</a> to a string that
   is not a <a href=#valid-floating-point-number>valid floating point number</a>. If the user agent
-  provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#valid-floating-point-number>valid
-  floating point number</a> representing the user's selection. User
-  agents must not allow the user to set the <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
+  provides a user interface for selecting a number, then the <a href=#concept-fe-value title=concept-fe-value>value</a> must be set to a <a href=#best-representation-of-the-floating-point-number>best
+  representation of the floating point number</a> representing the
+  user's selection. User agents must not allow the user to set the
+  <a href=#concept-fe-value title=concept-fe-value>value</a> to the empty string.</p>
 
   <p>The <code title=attr-input-value><a href=#attr-input-value>value</a></code> attribute, if
   specified, must have a value that is a <a href=#valid-floating-point-number>valid floating point

Modified: source
===================================================================
--- source	2009-02-01 05:23:43 UTC (rev 2730)
+++ source	2009-02-01 08:31:02 UTC (rev 2731)
@@ -1352,7 +1352,8 @@
      <li>Either a U+0065 LATIN SMALL LETTER E character or a U+0045
      LATIN CAPITAL LETTER E character.</li>
 
-     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.</li>
+     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character or U+002B
+     PLUS SIGN ("+") character.</li>
 
      <li>A series of characters in the range U+0030 DIGIT ZERO (0) to
      U+0039 DIGIT NINE (9).</li>
@@ -1372,9 +1373,19 @@
   HYPHEN-MINUS ("-") character and the number is not zero), and where
   the exponent is the number after the E, if any (interpreted as a
   negative number if there is a U+002D HYPHEN-MINUS ("-") character
-  between the E and the number and the number is not zero). If there
-  is no E, then the exponent is treated as zero.</p>
+  between the E and the number and the number is not zero, or else
+  ignoring a U+002B PLUS SIGN ("+") character between the E and the
+  number if there is one). If there is no E, then the exponent is
+  treated as zero.</p>
 
+  <p class="note">The values ±Infinity and NaN are not <span
+  title="valid floating point number">valid floating point
+  numbers</span>.</p>
+
+  <p>The <dfn>best representation of the floating point number</dfn>
+  <var title="">n</var> is the string obtained from applying the
+  ECMAScript operator ToString to <var title="">n</var>.</p>
+
   <p>The <dfn>rules for parsing floating point number values</dfn> are
   as given in the following algorithm. As with the previous
   algorithms, when this one is invoked, the steps must be followed in
@@ -1504,6 +1515,21 @@
 
       </ol>
 
+      <p>Otherwise, if the character indicated by <var
+      title="">position</var> is a U+002B PLUS SIGN ("+")
+      character:</p>
+
+      <ol>
+
+       <li>Advance <var title="">position</var> to the next
+       character.</li>
+
+       <li><p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, then return <var
+       title="">value</var>.</li>
+
+      </ol>
+
      </li>
 
      <li><p>If the character indicated by <var title="">position</var>
@@ -3582,7 +3608,7 @@
     the element</i>, as defined by the XML Base specification, with
     <i>the base URI of the document entity</i> being defined as the
     <span>document base URL</span> of the <code>Document</code> that
-    owns the element.</p>
+    owns the element. <a href="#refsXMLBASE">[XMLBASE]</a></p>
 
     <p>For the purposes of the XML Base specification, user agents
     must act as if all <code>Document</code> objects represented XML
@@ -5056,11 +5082,14 @@
   returned. If, on the other hand, it fails or returns an out of range
   value, or if the attribute is absent, the default value must be
   returned instead, or 0.0 if there is no default value. On setting,
-  the given value must be converted to the shortest possible string
-  representing the number as a <span>valid floating point
-  number</span> in base ten and then that string must be used as the
-  new content attribute value.</p>
+  the given value must be converted to the <span>best representation
+  of the floating point number</span> and then that string must be
+  used as the new content attribute value.</p>
 
+  <p class="note">The values ±Infinity and NaN throw an
+  exception on setting, as defined by WebIDL. <a
+  href="#refsWEBIDL">[WEBIDL]</a></p>
+
   <p>If a reflecting DOM attribute is of the type
   <code>DOMTokenList</code>, then on getting it must return a
   <code>DOMTokenList</code> object whose underlying string is the
@@ -29441,9 +29470,9 @@
   set the <span title="concept-fe-value">value</span> to a string that
   is not a <span>valid floating point number</span>. If the user agent
   provides a user interface for selecting a number, then the <span
-  title="concept-fe-value">value</span> must be set to a <span>valid
-  floating point number</span> representing the user's selection. User
-  agents should allow the user to set the <span
+  title="concept-fe-value">value</span> must be set to the <span>best
+  representation of the floating point number</span> representing the
+  user's selection. User agents should allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string.</p>
 
   <p>The <code title="attr-input-value">value</code> attribute, if
@@ -29565,10 +29594,10 @@
   set the <span title="concept-fe-value">value</span> to a string that
   is not a <span>valid floating point number</span>. If the user agent
   provides a user interface for selecting a number, then the <span
-  title="concept-fe-value">value</span> must be set to a <span>valid
-  floating point number</span> representing the user's selection. User
-  agents must not allow the user to set the <span
-  title="concept-fe-value">value</span> to the empty string.</p>
+  title="concept-fe-value">value</span> must be set to a <span>best
+  representation of the floating point number</span> representing the
+  user's selection. User agents must not allow the user to set the
+  <span title="concept-fe-value">value</span> to the empty string.</p>
 
   <p>The <code title="attr-input-value">value</code> attribute, if
   specified, must have a value that is a <span>valid floating point




More information about the Commit-Watchers mailing list