[html5] r2242 - [acgowt] (2) Change the 'floating point number' syntax to allow an exponent.

whatwg at whatwg.org whatwg at whatwg.org
Fri Sep 26 01:59:40 PDT 2008


Author: ianh
Date: 2008-09-26 01:59:40 -0700 (Fri, 26 Sep 2008)
New Revision: 2242

Modified:
   index
   source
Log:
[acgowt] (2) Change the 'floating point number' syntax to allow an exponent.

Modified: index
===================================================================
--- index	2008-09-25 11:02:58 UTC (rev 2241)
+++ index	2008-09-26 08:59:40 UTC (rev 2242)
@@ -29,7 +29,7 @@
 
    <h1 id=html-5>HTML 5</h1>
 
-   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 25
+   <h2 class="no-num no-toc" id=draft>Draft Recommendation — 26
     September 2008</h2>
 
    <p>You can take part in this work. <a
@@ -3465,12 +3465,34 @@
   <h5 id=real-numbers><span class=secno>2.4.3.3. </span>Real numbers</h5>
 
   <p>A string is a <dfn id=valid1>valid floating point number</dfn> if it
-   consists of one of more characters in the range U+0030 DIGIT ZERO (0) to
-   U+0039 DIGIT NINE (9), optionally with a single U+002E FULL STOP (".")
-   character somewhere (either before these numbers, in between two numbers,
-   or after the numbers), all optionally prefixed with a U+002D HYPHEN-MINUS
-   ("-") character.
+   consists of:
 
+  <ol class=brief>
+   <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.
+
+   <li>A series of one or more characters in the range U+0030 DIGIT ZERO (0)
+    to U+0039 DIGIT NINE (9).
+
+   <li>Optionally:
+    <ol>
+     <li>A single U+002E FULL STOP (".") character.
+
+     <li>A series of one or more characters in the range U+0030 DIGIT ZERO
+      (0) to U+0039 DIGIT NINE (9).
+    </ol>
+
+   <li>Optionally:
+    <ol>
+     <li>Either a U+0065 LATIN SMALL LETTER E character or a U+0045 LATIN
+      CAPITAL LETTER E character.
+
+     <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.
+
+     <li>A series of characters in the range U+0030 DIGIT ZERO (0) to U+0039
+      DIGIT NINE (9).
+    </ol>
+  </ol>
+
   <p>The <dfn id=rules1>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 the order given,
@@ -3487,12 +3509,15 @@
      title="">input</var>, initially pointing at the start of the string.
 
    <li>
-    <p>Let <var title="">value</var> have the value 0.
+    <p>Let <var title="">value</var> have the value 1.
 
    <li>
-    <p>Let <var title="">sign</var> have the value "positive".
+    <p>Let <var title="">divisor</var> have the value 1.
 
    <li>
+    <p>Let <var title="">exponent</var> have the value 1.
+
+   <li>
     <p><a href="#skip-whitespace">Skip whitespace</a>.
 
    <li>
@@ -3500,11 +3525,12 @@
      title="">input</var>, return an error.
 
    <li>
-    <p>If the character indicated by <var title="">position</var> (the first
-     character) is a U+002D HYPHEN-MINUS ("-") character:</p>
+    <p>If the character indicated by <var title="">position</var> is a U+002D
+     HYPHEN-MINUS ("-") character:</p>
 
     <ol>
-     <li>Let <var title="">sign</var> be "negative".
+     <li>Change <var title="">value</var> and <var title="">divisor</var> to
+      &#x2212;1.
 
      <li>Advance <var title="">position</var> to the next character.
 
@@ -3513,75 +3539,106 @@
     </ol>
 
    <li>
-    <p>If the next character is not one of U+0030 DIGIT ZERO (0) .. U+0039
-     DIGIT NINE (9) or U+002E FULL STOP ("."), then return an error.
-
-   <li>
-    <p>If the next character is U+002E FULL STOP ("."), but either that is
-     the last character or the character after that one is not one of U+0030
-     DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then return an error.
+    <p>If the character indicated by <var title="">position</var> is not one
+     of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then return an error.
    </li>
    <!-- Ok. At this point we know we have a number. It might have
    trailing garbage which we'll ignore, but it's a number, and we
    won't return an error. -->
 
    <li>
-    <p>If the next character is one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT
-     NINE (9):</p>
+    <p><a href="#collect">Collect a sequence of characters</a> in the range
+     U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+     resulting sequence as a base-ten integer. Multiply <var
+     title="">value</var> by that integer.
 
+   <li>If <var title="">position</var> is past the end of <var
+    title="">input</var>, return <var title="">value</var> and abort these
+    steps.
+
+   <li>
+    <p>If the character indicated by <var title="">position</var> is a U+002E
+     FULL STOP ("."), run these substeps:</p>
+
     <ol>
-     <li>Multiply <var title="">value</var> by ten.
+     <li>
+      <p>Advance <var title="">position</var> to the next character.
 
-     <li>Add the value of the current character (0..9) to <var
-      title="">value</var>.
+     <li>
+      <p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, or if the character indicated by <var
+       title="">position</var> is not one of U+0030 DIGIT ZERO (0) .. U+0039
+       DIGIT NINE (9), then return <var title="">value</var> and abort these
+       steps.
 
-     <li>Advance <var title="">position</var> to the next character.
+     <li>
+      <p><i>Fraction loop</i>: Multiply <var title="">divisor</var> by ten.
 
-     <li>If <var title="">position</var> is past the end of <var
-      title="">input</var>, then if <var title="">sign</var> is "positive",
-      return <var title="">value</var>, otherwise return 0-<var
+     <li>Add the value of the current character interpreted as a base-ten
+      digit (0..9) divided by <var title="">divisor</var>, to <var
       title="">value</var>.
 
-     <li>Otherwise return to the top of step 10 in the overall algorithm
-      (that's the step within which these substeps find themselves).
+     <li>
+      <p>Advance <var title="">position</var> to the next character.
+
+     <li>
+      <p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, then return <var title="">value</var> and abort
+       these steps.
+
+     <li>
+      <p>If the character indicated by <var title="">position</var> is one of
+       U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), return to the step
+       labeled <i>fraction loop</i> in these substeps.
     </ol>
 
    <li>
-    <p>Otherwise, if the next character is not a U+002E FULL STOP ("."), then
-     if <var title="">sign</var> is "positive", return <var
-     title="">value</var>, otherwise return 0-<var title="">value</var>.
+    <p>If the character indicated by <var title="">position</var> is a U+0065
+     LATIN SMALL LETTER E character or a U+0045 LATIN CAPITAL LETTER E
+     character, run these substeps:</p>
 
-   <li>
-    <p>The next character is a U+002E FULL STOP ("."). Advance <var
-     title="">position</var> to the character after that.
+    <ol>
+     <li>
+      <p>Advance <var title="">position</var> to the next character.
 
-   <li>
-    <p>Let <var title="">divisor</var> be 1.
+     <li>
+      <p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, then return <var title="">value</var> and abort
+       these steps.
 
-   <li>
-    <p>If the next character is one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT
-     NINE (9):</p>
+     <li>
+      <p>If the character indicated by <var title="">position</var> is a
+       U+002D HYPHEN-MINUS ("-") character:</p>
 
-    <ol>
-     <li>Multiply <var title="">divisor</var> by ten.
+      <ol>
+       <li>Change <var title="">exponent</var> to &#x2212;1.
 
-     <li>Add the value of the current character (0..9) divided by <var
-      title="">divisor</var>, to <var title="">value</var>.
+       <li>Advance <var title="">position</var> to the next character.
 
-     <li>Advance <var title="">position</var> to the next character.
+       <li>
+        <p>If <var title="">position</var> is past the end of <var
+         title="">input</var>, then return <var title="">value</var> and
+         abort these steps.
+      </ol>
 
-     <li>If <var title="">position</var> is past the end of <var
-      title="">input</var>, then if <var title="">sign</var> is "positive",
-      return <var title="">value</var>, otherwise return 0-<var
-      title="">value</var>.
+     <li>
+      <p>If the character indicated by <var title="">position</var> is not
+       one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then return
+       <var title="">value</var> and abort these steps.
 
-     <li>Otherwise return to the top of step 14 in the overall algorithm
-      (that's the step within which these substeps find themselves).
+     <li>
+      <p><a href="#collect">Collect a sequence of characters</a> in the range
+       U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+       resulting sequence as a base-ten integer. Multiply <var
+       title="">exponent</var> by that integer.
+
+     <li>
+      <p>Multiply <var title="">value</var> by ten raised to the <var
+       title="">exponent</var>th power.
     </ol>
 
    <li>
-    <p>Otherwise, if <var title="">sign</var> is "positive", return <var
-     title="">value</var>, otherwise return 0-<var title="">value</var>.
+    <p>Return <var title="">value</var>.
   </ol>
 
   <h5 id=ratios><span class=secno>2.4.3.4. </span>Ratios</h5>
@@ -29844,10 +29901,10 @@
    the URL represented by its <a href="#value12"
    title=concept-fe-value>value</a>. User agents may allow the user to set
    the <a href="#value12" title=concept-fe-value>value</a> to a string that
-   is not a <span>value URL</span>. User agents should allow the user to set
-   the <a href="#value12" title=concept-fe-value>value</a> to the empty
-   string. User agents must not allow users to insert U+000A LINE FEED (LF)
-   or U+000D CARRIAGE RETURN (CR) characters into the <a href="#value12"
+   is not a <a href="#valid9">valid URL</a>. User agents should allow the
+   user to set the <a href="#value12" title=concept-fe-value>value</a> to the
+   empty string. User agents must not allow users to insert U+000A LINE FEED
+   (LF) or U+000D CARRIAGE RETURN (CR) characters into the <a href="#value12"
    title=concept-fe-value>value</a>.
 
   <p><strong>The <a href="#value8">value sanitization algorithm</a> is as
@@ -30022,8 +30079,8 @@
   <p><strong>Constraint validation:</strong> When there is both a <a
    href="#selected" title=concept-input-value-datetime>selected UTC date and
    time</a> and a <a href="#minimum" title=concept-input-min-datetime>minimum
-   UTC date and time</a>, if the former is less than the latter, the element
-   is <a href="#suffering1">suffering from an underflow</a>.
+   UTC date and time</a>, if the former is earlier than the latter, the
+   element is <a href="#suffering1">suffering from an underflow</a>.
 
   <p>The <code title=attr-input-max><a href="#max4">max</a></code> attribute,
    if specified, must have a value that is a <a href="#valid6">valid UTC date
@@ -30037,11 +30094,18 @@
   <p><strong>Constraint validation:</strong> When there is both a <a
    href="#selected" title=concept-input-value-datetime>selected UTC date and
    time</a> and a <a href="#maximum" title=concept-input-max-datetime>maximum
-   UTC date and time</a>, if the former is more than the latter, the element
+   UTC date and time</a>, if the former is later than the latter, the element
    is <a href="#suffering2">suffering from an overflow</a>.
 
-  <p class=big-issue>... <code title=attr-input-step><a
-   href="#step0">step</a></code>
+  <p class=big-issue>The <code title=attr-input-step><a
+   href="#step0">step</a></code> attribute, if specified, must have a value
+   that is a ...</p>
+  <!-- values: positive non-zero floating point, or "any" -->
+  <!-- units: seconds -->
+  <!-- default: 60 -->
+  <!-- zero point: min, or 1970-01-01T00:00:00.0Z -->
+  <!-- allow rounding -->
+  <!-- <span>suffering from a step mismatch</span> -->
 
   <p>The following common <code><a href="#input0">input</a></code> element
    content attributes, DOM attributes, and methods apply to the element:

Modified: source
===================================================================
--- source	2008-09-25 11:02:58 UTC (rev 2241)
+++ source	2008-09-26 08:59:40 UTC (rev 2242)
@@ -1263,12 +1263,46 @@
   <h5>Real numbers</h5>
 
   <p>A string is a <dfn>valid floating point number</dfn> if it
-  consists of one of more characters in the range U+0030 DIGIT ZERO
-  (0) to U+0039 DIGIT NINE (9), optionally with a single U+002E FULL
-  STOP (".") character somewhere (either before these numbers, in
-  between two numbers, or after the numbers), all optionally prefixed
-  with a U+002D HYPHEN-MINUS ("-") character.</p>
+  consists of:</p>
 
+  <ol class="brief">
+
+   <li>Optionally, a U+002D HYPHEN-MINUS ("-") character.</li>
+
+   <li>A series of one or more characters in the range U+0030 DIGIT
+   ZERO (0) to U+0039 DIGIT NINE (9).</li>
+
+   <li>Optionally:
+
+    <ol>
+
+     <li>A single U+002E FULL STOP (".") character.</li>
+
+     <li>A series of one or more characters in the range U+0030 DIGIT
+     ZERO (0) to U+0039 DIGIT NINE (9).</li>
+
+    </ol>
+
+   </li>
+
+   <li>Optionally:
+
+    <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>A series of characters in the range U+0030 DIGIT ZERO (0) to
+     U+0039 DIGIT NINE (9).</li>
+
+    </ol>
+
+   </li>
+
+  </ol>
+
   <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
@@ -1286,23 +1320,26 @@
    title="">input</var>, initially pointing at the start of the
    string.</p></li>
 
-   <li><p>Let <var title="">value</var> have the value 0.</li>
+   <li><p>Let <var title="">value</var> have the value 1.</li>
 
-   <li><p>Let <var title="">sign</var> have the value "positive".</li>
+   <li><p>Let <var title="">divisor</var> have the value 1.</p></li>
 
+   <li><p>Let <var title="">exponent</var> have the value 1.</p></li>
+
    <li><p><span>Skip whitespace</span>.</p></li>
 
    <li><p>If <var title="">position</var> is past the end of <var
-    title="">input</var>, return an error.</p></li>
+   title="">input</var>, return an error.</p></li>
 
    <li>
 
-    <p>If the character indicated by <var title="">position</var> (the
-    first character) is a U+002D HYPHEN-MINUS ("-") character:</p>
+    <p>If the character indicated by <var title="">position</var> is a
+    U+002D HYPHEN-MINUS ("-") character:</p>
 
     <ol>
 
-     <li>Let <var title="">sign</var> be "negative".</li>
+     <li>Change <var title="">value</var> and <var
+     title="">divisor</var> to &#x2212;1.</li>
 
      <li>Advance <var title="">position</var> to the next
      character.</li>
@@ -1314,88 +1351,110 @@
 
    </li>
 
-   <li><p>If the next character is not one of U+0030 DIGIT ZERO (0)
-   .. U+0039 DIGIT NINE (9) or U+002E FULL STOP ("."), then return an
-   error.</p></li>
+   <li><p>If the character indicated by <var title="">position</var>
+   is not one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then
+   return an error.</p></li>
 
-   <li><p>If the next character is U+002E FULL STOP ("."), but either
-   that is the last character or the character after that one is not
-   one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), then return
-   an error.</p></li>
-
    <!-- Ok. At this point we know we have a number. It might have
    trailing garbage which we'll ignore, but it's a number, and we
    won't return an error. -->
 
-   <li>
+   <li><p><span>Collect a sequence of characters</span> in the range
+   U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+   resulting sequence as a base-ten integer. Multiply <var
+   title="">value</var> by that integer.</p></li>
 
-    <p>If the next character is one of U+0030 DIGIT ZERO (0) .. U+0039
-    DIGIT NINE (9):</p>
+   <li>If <var title="">position</var> is past the end of <var
+   title="">input</var>, return <var title="">value</var> and abort
+   these steps.</li>
 
+   <li><p>If the character indicated by <var title="">position</var>
+   is a U+002E FULL STOP ("."), run these substeps:</p>
+
     <ol>
 
-     <li>Multiply <var title="">value</var> by ten.</li>
+     <li><p>Advance <var title="">position</var> to the next
+     character.</p></li>
 
-     <li>Add the value of the current character (0..9) to <var
-     title="">value</var>.</li>
+     <li><p>If <var title="">position</var> is past the end of <var
+     title="">input</var>, or if the character indicated by <var
+     title="">position</var> is not one of U+0030 DIGIT ZERO (0)
+     .. U+0039 DIGIT NINE (9), then return <var title="">value</var>
+     and abort these steps.</li>
 
-     <li>Advance <var title="">position</var> to the next
-     character.</li>
+     <li><p><i>Fraction loop</i>: Multiply <var title="">divisor</var>
+     by ten.</p></li>
 
-     <li>If <var title="">position</var> is past the end of <var
-     title="">input</var>, then if <var title="">sign</var> is
-     "positive", return <var title="">value</var>, otherwise return
-     0-<var title="">value</var>.</li>
+     <li>Add the value of the current character interpreted as a
+     base-ten digit (0..9) divided by <var title="">divisor</var>, to
+     <var title="">value</var>.</li>
 
-     <li>Otherwise return to the top of step 10 in the overall
-     algorithm (that's the step within which these substeps find
-     themselves).</li>
+     <li><p>Advance <var title="">position</var> to the next
+     character.</p></li>
 
+     <li><p>If <var title="">position</var> is past the end of <var
+     title="">input</var>, then return <var title="">value</var> and
+     abort these steps.</li>
+
+     <li><p>If the character indicated by <var title="">position</var>
+     is one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9), return
+     to the step labeled <i>fraction loop</i> in these
+     substeps.</p></li>
+
     </ol>
 
    </li>
 
-   <li><p>Otherwise, if the next character is not a U+002E FULL STOP
-   ("."), then if <var title="">sign</var> is "positive", return <var
-   title="">value</var>, otherwise return 0-<var
-   title="">value</var>.</p></li>
+   <li><p>If the character indicated by <var title="">position</var>
+   is a U+0065 LATIN SMALL LETTER E character or a U+0045 LATIN
+   CAPITAL LETTER E character, run these substeps:</p>
 
-   <li><p>The next character is a U+002E FULL STOP ("."). Advance <var
-   title="">position</var> to the character after that.</p></li>
+    <ol>
 
-   <li><p>Let <var title="">divisor</var> be 1.</p></li>
+     <li><p>Advance <var title="">position</var> to the next
+     character.</p></li>
 
-   <li>
+     <li><p>If <var title="">position</var> is past the end of <var
+     title="">input</var>, then return <var title="">value</var> and
+     abort these steps.</li>
 
-    <p>If the next character is one of U+0030 DIGIT ZERO (0) .. U+0039
-    DIGIT NINE (9):</p>
+     <li>
 
-    <ol>
+      <p>If the character indicated by <var title="">position</var> is
+      a U+002D HYPHEN-MINUS ("-") character:</p>
 
-     <li>Multiply <var title="">divisor</var> by ten.</li>
+      <ol>
 
-     <li>Add the value of the current character (0..9) divided by <var
-     title="">divisor</var>, to <var title="">value</var>.</li>
+       <li>Change <var title="">exponent</var> to &#x2212;1.</li>
 
-     <li>Advance <var title="">position</var> to the next
-     character.</li>
+       <li>Advance <var title="">position</var> to the next
+       character.</li>
 
-     <li>If <var title="">position</var> is past the end of <var
-     title="">input</var>, then if <var title="">sign</var> is
-     "positive", return <var title="">value</var>, otherwise return
-     0-<var title="">value</var>.</li>
+       <li><p>If <var title="">position</var> is past the end of <var
+       title="">input</var>, then return <var title="">value</var> and
+       abort these steps.</li>
 
-     <li>Otherwise return to the top of step 14 in the overall
-     algorithm (that's the step within which these substeps find
-     themselves).</li>
+      </ol>
 
+     </li>
+
+     <li><p>If the character indicated by <var title="">position</var>
+     is not one of U+0030 DIGIT ZERO (0) .. U+0039 DIGIT NINE (9),
+     then return <var title="">value</var> and abort these steps.</li>
+
+     <li><p><span>Collect a sequence of characters</span> in the range
+     U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), and interpret the
+     resulting sequence as a base-ten integer. Multiply <var
+     title="">exponent</var> by that integer.</p></li>
+
+     <li><p>Multiply <var title="">value</var> by ten raised to the
+     <var title="">exponent</var>th power.</p></li>
+
     </ol>
 
    </li>
 
-   <li><p>Otherwise, if <var title="">sign</var> is "positive", return
-   <var title="">value</var>, otherwise return 0-<var
-   title="">value</var>.</p></li>
+   <li><p>Return <var title="">value</var>.</p></li>
 
   </ol>
 
@@ -26335,7 +26394,7 @@
   should allow the user to change the URL represented by its <span
   title="concept-fe-value">value</span>. User agents may allow the
   user to set the <span title="concept-fe-value">value</span> to a
-  string that is not a <span>value URL</span>. User agents should
+  string that is not a <span>valid URL</span>. User agents should
   allow the user to set the <span
   title="concept-fe-value">value</span> to the empty string. User
   agents must not allow users to insert U+000A LINE FEED (LF) or
@@ -26502,8 +26561,8 @@
   <p><strong>Constraint validation:</strong> When there is both a
   <span title="concept-input-value-datetime">selected UTC date and
   time</span> and a <span title="concept-input-min-datetime">minimum
-  UTC date and time</span>, if the former is less than the latter, the
-  element is <span>suffering from an underflow</span>.</p>
+  UTC date and time</span>, if the former is earlier than the latter,
+  the element is <span>suffering from an underflow</span>.</p>
 
   <p>The <code title="attr-input-max">max</code> attribute, if
   specified, must have a value that is a <span>valid UTC date and
@@ -26518,11 +26577,19 @@
   <p><strong>Constraint validation:</strong> When there is both a
   <span title="concept-input-value-datetime">selected UTC date and
   time</span> and a <span title="concept-input-max-datetime">maximum
-  UTC date and time</span>, if the former is more than the latter, the
-  element is <span>suffering from an overflow</span>.</p>
+  UTC date and time</span>, if the former is later than the latter,
+  the element is <span>suffering from an overflow</span>.</p>
 
-  <p class="big-issue">... <code title="attr-input-step">step</code></p>
+  <p class="big-issue">The <code title="attr-input-step">step</code>
+  attribute, if specified, must have a value that is a ...</p>
 
+  <!-- values: positive non-zero floating point, or "any" -->
+  <!-- units: seconds -->
+  <!-- default: 60 -->
+  <!-- zero point: min, or 1970-01-01T00:00:00.0Z -->
+  <!-- allow rounding -->
+  <!-- <span>suffering from a step mismatch</span> -->
+
   <p>The following common <code>input</code> element content
   attributes, DOM attributes, and methods apply to the element:
   <code title="attr-input-autocomplete">autocomplete</code>,




More information about the Commit-Watchers mailing list