RE: float/double :conversion from lexical space to value space

The Schema WG discussed your comments in great detail over the
Last couple of days.  We decided to change the wording so that
The conversion of lexical space to value space is as defined by
Clinger's paper which is a normative reference to the spec.

With respect to your specific question, if the "best approximation"
Is a number that cannot be represented with the number of bits in the
Float or double datatype, then it will be represented by INF or -INF.

Regards, Ashok

-----Original Message-----
From: Kohsuke KAWAGUCHI [mailto:kohsuke.kawaguchi@eng.sun.com] 
Sent: Thursday, March 22, 2001 12:05 PM
To: www-xml-schema-comments@w3.org
Subject: 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 Friday, 13 April 2001 16:40:15 UTC