xsl-list
[Top] [All Lists]

RE: Floating point precision error

2006-01-26 18:19:43
Mike,

At 1/26/2006 05:45 PM, Michael Kay wrote:
>
> >
> > Michael, if you don't mind me asking, how do you explicitly
> > set the precision? It's not something to do with xs:float() and
> > xs:double() is it? I tried them out but it seems they're not
> > supported.
>
>XSLT 2.0 allows you to use xs:float(...) to get a value as a single
>precision floating point number. (Why anyone wants to use 32-bit floats in
>the 21st century is beyond me, but they're in XSLT because they're in schema
>and they're in schema because they're in SQL...)

Oh, no, they're not "in SQL".  The SQL standard says nothing about how many
bits or digits there are in any of its numeric types.  Here is the entire
definition of SQL's approximate numeric types (as they are called):

26) FLOAT specifies the data type approximate numeric, with binary
precision equal to or greater than the
value of the specified <precision>. The maximum value of <precision> is
implementation-defined. <precision>
shall not be greater than this value.

27) REAL specifies the data type approximate numeric, with
implementation-defined precision.

28) DOUBLE PRECISION specifies the data type approximate numeric, with
implementation-defined precision
that is greater than the implementation-defined precision of REAL.

29) For the <approximate numeric type>s FLOAT, REAL, and DOUBLE PRECISION,
the maximum and
minimum values of the exponent are implementation-defined.

As far as I can tell, Schema has them because IEEE 754 has them.

Hope this helps,
    Jim



> >
> > Oh and as I mentioned, I only got this on SunOS. Would it have
> > something to do with the OS?
>
>You'll have to ask the Xalan folks about that.
>
>Michael Kay
>http://www.saxonica.com/
>
>
>
>--~------------------------------------------------------------------
>XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
>or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
>--~--

========================================================================
Jim Melton --- Editor of ISO/IEC 9075-* (SQL)     Phone: +1.801.942.0144
  Co-Chair, W3C XML Query WG; F&O (etc.) editor    Fax : +1.801.942.3345
Oracle Corporation        Oracle Email: jim dot melton at oracle dot com
1930 Viscounti Drive      Standards email: jim dot melton at acm dot org
Sandy, UT 84093-1063 USA          Personal email: jim at melton dot name
========================================================================
=  Facts are facts.   But any opinions expressed are the opinions      =
=  only of myself and may or may not reflect the opinions of anybody   =
=  else with whom I may or may not have discussed the issues at hand.  =
========================================================================
--=====================_1576168480==.ALT--

========================================================================
Jim Melton --- Editor of ISO/IEC 9075-* (SQL)     Phone: +1.801.942.0144
  Co-Chair, W3C XML Query WG; F&O (etc.) editor    Fax : +1.801.942.3345
Oracle Corporation        Oracle Email: jim dot melton at oracle dot com
1930 Viscounti Drive      Standards email: jim dot melton at acm dot org
Sandy, UT 84093-1063 USA          Personal email: jim at melton dot name
========================================================================
=  Facts are facts.   But any opinions expressed are the opinions      =
=  only of myself and may or may not reflect the opinions of anybody   =
=  else with whom I may or may not have discussed the issues at hand.  =
========================================================================


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>