float/double :conversion from lexical space to value space

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,

http://java.sun.com/j2se/1.3/docs/api/java/lang/Float.html
> 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.


regards,
----------------------
K.Kawaguchi
E-Mail: k-kawa@bigfoot.com

Received on Thursday, 22 March 2001 15:05:03 UTC