W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > January to March 2009

RE: Canonical representation of float/double and number of digits

From: Dave Peterson <davep@iit.edu>
Date: Mon, 2 Feb 2009 11:22:31 -0500
Message-Id: <a06240801c5acc9d42a8e@[192.168.1.101]>
To: Michael Kay <mike@saxonica.com>, "'Vincent Lefevre'" <vincent@vinc17.org>, www-xml-schema-comments@w3.org
Cc: vincent@vinc17.org

At 3:59 PM +0000 2009-02-02, Michael Kay wrote:
>
>You might like to take into account that XSD 1.1 defines a canonical
>representation more precisely:
>
>http://www.w3.org/TR/xmlschema11-2/#f-doubleCanmap

But note also that this canonical mapping is but one of many allowed by
IEEE 754, and hence by Schema 1.1.  In any case, The canonical mappings
defined in the Schema 1.1 spec are there merely for the convenience of
anyone who wishes to use the Part 2 datatype specifications for other
purposes--and such a user can certainly specify a different canonical
mapping if it better suits his or her purposes.

In any case, note that the specific algorithm given in the reference
above may for some arguments require unbounded memory, and the same
results can be obtained in bounded memory by the more complicated
algorithm given in:

William D Clinger. How to Read Floating Point Numbers Accurately. In
    Proceedings of Conference on Programming Language Design and
    Implementation, pages 92-101. Available at:
    ftp://ftp.ccs.neu.edu/pub/people/will/howtoread.ps

(The unbounded memory is actually required in a sub-function,
http://www.w3.org/TR/xmlschema11-2/#f-floatPtRound .)

(Probably more than you ever wanted to know on the subject.  Sorry.
Feel free to ignore it.)
-- 
Dave Peterson
SGMLWorks!

davep@iit.edu
Received on Monday, 2 February 2009 16:23:13 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:50:09 UTC