This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 13689 - Floating point numbers beginning with a dot should be valid and parsed correctly
Summary: Floating point numbers beginning with a dot should be valid and parsed correctly
Status: RESOLVED FIXED
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: ---
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks: 12220
  Show dependency treegraph
 
Reported: 2011-08-06 03:33 UTC by contributor
Modified: 2011-10-05 18:08 UTC (History)
8 users (show)

See Also:


Attachments

Description contributor 2011-08-06 03:33:33 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/common-microsyntaxes.html#valid-floating-point-number
Multipage: http://www.whatwg.org/C#floating-point-numbers
Complete: http://www.whatwg.org/c#floating-point-numbers

Comment:
Is it intentional that floating point numbers beginning with a dot are not a
valid floating point numbers?  It took a fair amount of reading through the
spec to figure out why <input type="number" step=".5"> doesn't do what it
looks like it should do.  <input type="number" step="0.5"> of course works.

Posted from: 69.251.188.87
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7) AppleWebKit/534.48.3 (KHTML, like Gecko) Version/5.1 Safari/534.48.3
Comment 1 Ian 'Hixie' Hickson 2011-08-06 03:55:27 UTC
Yes, it is intentional.

Maybe it should change?
Comment 3 Aryeh Gregor 2011-08-08 14:40:01 UTC
Seems like something that should change -- there's no reason to make this invalid that I see.
Comment 4 Ian 'Hixie' Hickson 2011-08-08 21:49:56 UTC
Opera also. Not WebKit.
Comment 5 Jonas Sicking (Not reading bugmail) 2011-08-22 20:34:40 UTC
It's been brought up elsewhere that we should just use the same algorithm as ECMAScript uses to parse floats. This seems like a good idea to me and would fix this issue.
Comment 6 Aryeh Gregor 2011-08-22 20:57:35 UTC
That's bug 12220 -- which is currently WONTFIX, so you should probably reopen it if you want it fixed.

I just looked again and discovered that this actually does affect implementer requirements, not just author requirements.  ".5" isn't just invalid, parsing it returns an error.  This seems very surprising.  From the summary, I thought it was just an authoring requirement.
Comment 7 Ian 'Hixie' Hickson 2011-10-05 18:08:29 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: see diff given below
Rationale: Concurred with reporter's comments.
Comment 8 contributor 2011-10-05 18:08:42 UTC
Checked in as WHATWG revision r6635.
Check-in comment: Allow omission of the number before the period in a floating point number.
http://html5.org/tools/web-apps-tracker?from=6634&to=6635