W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2012

[Bug 16075] New: Make a float/double type that excludes NaN/Infinity/-Infinity

From: <bugzilla@jessica.w3.org>
Date: Wed, 22 Feb 2012 14:52:54 +0000
To: public-script-coord@w3.org
Message-ID: <bug-16075-3890@http.www.w3.org/Bugs/Public/>
https://www.w3.org/Bugs/Public/show_bug.cgi?id=16075

           Summary: Make a float/double type that excludes
                    NaN/Infinity/-Infinity
           Product: WebAppsWG
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: WebIDL
        AssignedTo: cam@mcc.id.au
        ReportedBy: ayg@aryeh.name
         QAContact: public-webapps-bugzilla@w3.org
                CC: ian@hixie.ch, jgraham@opera.com, mike@w3.org,
                    annevk@opera.com, public-script-coord@w3.org


float/double can be NaN/Infinity/-Infinity.  This is probably not desired by
most if not all interfaces that use them.  The uses of float/double in HTML are
the following, as far as I can tell, excluding readonly attributes and return
types (since behavior there doesn't really matter):

* HTMLMediaElement and MediaController: .currentTime, .playbackRate,
.defaultPlaybackRate, .volume
* TextTrackCue: constructor, .startTime and .endTime
* CanvasRenderingContext2D: scale(), rotate(), translate(), transform(),
setTransform(), .globalAlpha, about a million others
* HTMLInputElement: .valueAsNumber
* HTMLProgressElement: .value, .max
* HTMLMeterElement: .value, .min, .max, .low, .high, .optimum

The CSS Transforms spec also currently uses doubles for CSSMatrix (see bug
15964), and SVG defines some interfaces like that as well (SVGPoint, SVGMatrix,
etc.).

In all of these cases, as far as I can tell, NaN and infinite values are
unlikely to be wanted.  Moreover, looking at a sampling of them, they seem to
not define handling for those cases.  It is entirely unclear what should happen
if you set a video element's .currentTime to NaN or Infinity, for instance, or
if you try to scale() a canvas by a factor of NaN or Infinity.  The spec
doesn't say.

I suggest that the IDL float and double types be defined to exclude NaN,
Infinity, and -Infinity values.  Trying to convert such a value to float or
double should raise a TypeError.  If there are any WebIDL users that actually
want to allow such values, it should be via an extended attribute that lets
them opt in.

-- 
Configure bugmail: https://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Wednesday, 22 February 2012 14:53:00 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:05 UTC