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

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

From: <bugzilla@jessica.w3.org>
Date: Mon, 05 Mar 2012 00:47:11 +0000
To: public-script-coord@w3.org
Message-Id: <E1S4M51-0005ma-VD@jessica.w3.org>
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

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