RE: Representation of floating point values.

The reference to Clinger/Gay is a red herring.  ( I have the paper somewhere and can find it if need be).
Clinger/Gay address the folllowing problem -- given a lexical representation of a float/double what is the best (closest) machine representation for it.  The paper is not focussed on min/max values.

The Schema spec does not explicitly say anything about very large and very small values except that
the float/double datatypes follow IEEE 754.  The F&O specification about overflow and underflow
was crafted after much discussion and allows the IEEE options.  See first 2 bullets in 6.2.

What language would you like changed?

All the best, Ashok
 

> -----Original Message-----
> From: w3c-xml-query-wg-request@w3.org 
> [mailto:w3c-xml-query-wg-request@w3.org] On Behalf Of Michael Kay
> Sent: Monday, March 07, 2005 2:37 PM
> To: 'Daniel Engovatov'; www-xml-schema-comments@w3.org
> Cc: w3c-xml-query-wg@w3.org
> Subject: RE: Representation of floating point values.
> 
> 
> We're both right: Java appears to use option 3 for 
> compile-time literals, option 2 for the Double.parseDouble() 
> method (string to double conversion).
> 
> Michael Kay
>  
> 
> > -----Original Message-----
> > From: Daniel Engovatov [mailto:dengovatov@bea.com]
> > Sent: 07 March 2005 22:23
> > To: Michael Kay; www-xml-schema-comments@w3.org
> > Cc: w3c-xml-query-wg@w3.org
> > Subject: RE: Representation of floating point values.
> > 
> > 
> > >Of the three possible options:
> > 
> > >1. Map to the largest finite double
> > >2. Map to +Infinity
> > >3. Raise an error
> > 
> > >option 1 seems the least desirable.
> > 
> > >Java does (2).
> > 
> > 
> > According to
> > 
> > http://java.sun.com/docs/books/jls/second_edition/html/lexical
> > .doc.html#
> > 230798
> >  
> > Java uses option 3, doesn't it?  Quote:
> > 
> > " A compile-time error occurs if a nonzero floating-point 
> literal is 
> > too large, so that on rounded conversion to its internal 
> > representation it becomes an IEEE 754 infinity. A program can 
> > represent infinities without producing a compile-time error 
> by using 
> > constant expressions such as 1f/0f or -1d/0d or by using the 
> > predefined constants POSITIVE_INFINITY and NEGATIVE_INFINITY of the 
> > classes Float and Double."
> > 
> > Actually, this document has the same bug, as a "rounded conversion" 
> > can not be infinity.
> > 
> > I would imagine that raising an error (not a valid 
> representation of 
> > an Floating point literal) is the most desirable outcome.  
> If somebody 
> > wanted an INF, there are explicit way to construct it.
> > 
> > Daniel;
> > 
> >  
> > 
> > > -----Original Message-----
> > > From: w3c-xml-query-wg-request@w3.org 
> > > [mailto:w3c-xml-query-wg-request@w3.org] On Behalf Of
> > Daniel Engovatov
> > > Sent: 07 March 2005 21:43
> > > To: www-xml-schema-comments@w3.org
> > > Cc: w3c-xml-query-wg@w3.org
> > > Subject: Representation of floating point values.
> > > 
> > > 
> > > During our recent XQuery working group meeting we have
> > closed an issue
> > > regarding what should be done if a numerical literal 
> representing a 
> > > float or double value is out of range for IEEE 754 values 
> (positive 
> > > and negative overflow or underflow).
> > > 
> > > --------
> > > RESOLUTION: Too big float/double values.
> > > 
> > 
> http://lists.w3.org/Archives/Member/w3c-xml-query-wg/2005Feb/0084.html
> > > is rejected. No action required to 3.1.1. Schema says that
> > one should
> > > map to the largest float or double value.
> > > --------
> > > 
> > > It does seem to me that this is an unfortunate choice in
> > the Schema to
> > > just map a non-representable number into another number.  
> Probably, 
> > > other options should be allowed for an implementation, such
> > raising an
> > > error and mapping to +/- INF.
> > > 
> > > Sincerely,
> > > 
> > > Daniel Engovatov.   
> > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> > 
> > 
> > 
> 
> 
> 
> 
> 

Received on Monday, 7 March 2005 23:17:09 UTC