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

https://www.w3.org/Bugs/Public/show_bug.cgi?id=16075

--- Comment #3 from Cameron McCormack <cam@mcc.id.au> 2012-03-05 00:47:09 UTC ---
I can see that it would be useful to distinguish between float/double values
that take non-finite values and ones that don't in the IDL.  Rather than an
extended attribute, I think it would be good to just have a separate type to
distinguish them.

On the one hand, to me "float" and "double" really sound like the C types,
where you can have NaNs and ±Infinity.  So removing those values by default
from those types doesn't seem right.  Thus my first thought would be to have
maybe "float" and "finite float" types.  OTOH, it's clear that not including
those values is more common, so littering most uses of "float" with "finite" is
maybe not the best solution.  If there is a succinct word we could place in
front of "float" to mean "including the non-finite values" I can't think of it
right now. :)

(Silently ignoring like on canvas calls could be done with an extended
attribute or just by using the type that includes the non-finite values and
defining the canvas operations to do nothing when those values are passed in.)

A crazy thought: define special types to represent NaN and ±Infinity and use
union types when you want them:

  void f((float or NaN) x);

-- 
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 Monday, 5 March 2012 00:47:18 UTC