# Constraint on the lexical space of xs:float (was Re: (invalid?) floats and doubles in NIST's validation testsuite)

From: Eric van der Vlist <vdv@dyomedea.com>
Date: Thu, 25 Oct 2001 21:10:08 +0200
Message-ID: <3BD86390.8010500@dyomedea.com>
To: Anli Shundi <ashundi@tibco.com>

```Hi,

I have a question which goes along with this question kept without

The rec doesn't seem to put any restriction on the range of xs:float in
its lexical space:

...............................
3.2.4.1 Lexical representation

float values have a lexical representation consisting of a mantissa
followed, optionally, by the character "E" or "e", followed by an
exponent. The exponent ·must· be an integer. The mantissa must be a
decimal number. The representations for exponent and mantissa must
follow the lexical rules for integer and decimal. If the "E" or "e" and
the following exponent are omitted, an exponent value of 0 is assumed.

The special values positive and negative zero, positive and negative
infinity and not-a-number have lexical representations 0, -0, INF, -INF
and NaN, respectively.

For example, -1E4, 1267.43233E12, 12.78e-2, 12 and INF are all legal
literals for float.
...............................

The rule given to match lexical an value spaces doesn't restrict the
lexical space either:

...............................
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
in the sense defined by [Clinger, WD (1990)]; if d is exactly halfway
between two such values then the even value is chosen.
...............................

Whatever literal you take, there will allways be a "float that is
closest to d in the sense defined by [Clinger, WD (1990)]" it will
eventually be the maximum value of a float for an arbitrary big value in
the lexical space, the minimum value of a float for an arbitrary big
negative value, -0 or +0 for an arbitrary small value, but this matching
seems to exclude the possibility of any overflow.

Is my interpretation correct and isn't it dangerous to be unable to
detect overflows?

Thanks

Eric

Anli Shundi wrote:

> Hi,
>
> many of the floats and doubles in the NIST validation
> testsuite at http://www.w3.org/2001/05/xmlschema-test-collection/
> are IMO out of range.  According to the spec:
>
> float corresponds to the IEEE single-precision 32-bit floating point type
> [IEEE 754-1985]. The basic ·value space· of float consists of the values m ×
> 2^e, where m is an integer whose absolute value is less than 2^24, and e is
> an integer between -149 and 104, inclusive.
>
> The lexical representation uses the decimal powers
> though.  Thus the biggest representable float short of
> infinity is 2^24 * 2^104 = 3.40283E38 .  The testsuite
> uses floats such as 16777215.999999999999E104 which
> is IMO invalid, since it's out of float's value space.
> (Note that 2^24 = 16777216 in the above case)
>
> Such floats and doubles with absolute values greater
> than 1.79E308 or smaller than 4.94E-324 are throughout
> the testsuite and they are all considered valid ?!
>
> Question: does the E in lexical representation actually
> stand for binary or decimal powers?
>
> Anli Shundi                      ashundi@tibco.com
> Product Development Group        office: (919) 969-6518
> TIBCO Software Inc.
>
> www.extensibility.com  |  www.XMLschema.com  |  www.tibco.com
>
>
>
>
>

--
Rendez-vous à Paris pour le Forum XML.
http://www.technoforum.fr/Pages/forumXML01/index.html
------------------------------------------------------------------------
Eric van der Vlist       http://xmlfr.org            http://dyomedea.com
http://xsltunit.org      http://4xt.org           http://examplotron.org
------------------------------------------------------------------------
```
Received on Thursday, 25 October 2001 15:09:48 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:54 UTC