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

float/double :conversion from lexical space to value space

From: Kohsuke KAWAGUCHI <kohsuke.kawaguchi@eng.sun.com>
Date: Thu, 22 Mar 2001 12:05:09 -0800
To: www-xml-schema-comments@w3.org
Message-Id: <20010322115643.22FE.KOHSUKE.KAWAGUCHI@eng.sun.com>

Dear XML Schema WG members,

I have an implementation feedback about "float"/"double" type.

XML Schema defines "mapping" from float lexical space to float value
space as follows

(from the section 3.2.4)
> A literal in the lexical space representing a decimal number d maps to
> the normalized value in the value space of float that is closest to d; 

As you can see, it says "closest".
Therefore, its natural interpretation is when the converter see "1e999",
which means "+1.0 * 10^999", which is way over the value range of float
type (roughly +- 3.4 * 10^38), it still has to convert it to 3.4*10^38,
because it is the closest value in float.

So the net result is "1e999" will be converted to 3.4*10^38

I think this causes a headache for implementator because they have
to re-implement conversion routine by myself!
Also, this is a problem for user. Nobody wants "1e999" to be interpreted
as "3.4e38" without any warning or error.

The same problem happens for double; the only difference is the upper
bound of value range.

I guess this behavior is not the intention of Schema WG. If so, please
change the definition of mapping. For example, in Java,

> it is regarded as representing an exact decimal value in the usual
> "computerized scientific notation"; this exact decimal value is then
> conceptually converted to an "infinitely precise" binary value that is
> then rounded to type float by the usual round-to-nearest rule of IEEE
> 754 floating-point arithmetic.

E-Mail: k-kawa@bigfoot.com
Received on Thursday, 22 March 2001 15:05:03 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:49:54 UTC