[om] OM Floats (XML Representation)

Mike Dewar miked at nag.co.uk
Mon Dec 1 16:47:28 CET 2003


My mistake, it turns out that Java changed the way it handled NaNs at
some point, the spec at
http://java.sun.com/docs/books/jls/second_edition/html/typesValues.doc.html#88071
contains the text:

 IEEE 754 allows multiple distinct NaN values for each of its single and
 double floating-point formats. While each hardware architecture returns
 a particular bit pattern for NaN when a new NaN is generated, a
 programmer can also create NaNs with different bit patterns to encode,
 for example, retrospective diagnostic information.
 
 For the most part, the Java platform treats NaN values of a given type
 as though collapsed into a single canonical value (and hence this
 specification normally refers to an arbitrary NaN as though to a
 canonical value). However, version 1.3 the Java platform introduced
 methods enabling the programmer to distinguish between NaN values: the
 Float.floatToRawIntBits and Double.doubleToRawLongBits methods. The
 interested reader is referred to the specifications for the Float and
 Double classes for more information.

Mike.


On Mon, Dec 01, 2003 at 07:23:34AM -0800, Richard Fateman wrote:
> I haven't looked (recently) at the Java treatment of IEEE NaN,
> but unless it redefines the underlying hardware, there should be lots
> of NaNs in it.  There may be one canonical NaN value (in each format)
> if you do  x = NaN, but that doesn't prevent a program from using
> a different NaN.
> 
> Before you take too much guidance from Java, you might also look at
> 
> http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf
> 
> which contains a paper, "How Java's floating point hurts everyone 
> everywhere".
> 
> It is my own view that the goals of clean algebraic specification and 
> practical floating point
> computation are probably irreconcilable, my own efforts included.  Over 
> the years
> I have written a number of papers relating IEEE floats and computer 
> algebra, all of which
> have been rejected by ISSAC program committee members as being irrelevant to
> computer algebra. Maybe they are right, that they are mutually 
> exclusive.  In which
> case maybe OM should just encapsulate IEEE floats as some kind of 
> foreign object.
> 
> (In case you wonder about what those papers might be about,
> one can use signed infinities nicely in  interval arithmetic, and for 
> retrospective
> diagnostics. I think they are all on line.
> 
> I don't know if there is an OM CD for intervals yet.)
> 
> RJF
> 
> 
> ...............
> 
> 
> Mike Dewar wrote:
> 
> >I agree with James - we ought to stick with the IEEE definition of NaN
> >since the XSD one is so far out of step with other standards.  However
> >Bill was right to note that Java only has one NaN value, even though the
> >IEEE standard allows lots (as pointed out by Richard Fateman), so not
> >everybody else is fully IEEE compliant either.  This should perhaps be
> >pointed out in the standard as a possible issue for phrasebook
> >developers.
> >
> >.....
> >  
> >
> 
> --
> om at openmath.org  -  general discussion on OpenMath
> Post public announcements to om-announce at openmath.org
> Automatic list maintenance software at majordomo at openmath.org
> Mail om-owner at openmath.org for assistance with any problems
> 
> ________________________________________________________________________
> This e-mail has been scanned for all viruses by Star Internet. The
> service is powered by MessageLabs. For more information on a proactive
> anti-virus service working around the clock, around the globe, visit:
> http://www.star.net.uk
> ________________________________________________________________________

________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
--
om at openmath.org  -  general discussion on OpenMath
Post public announcements to om-announce at openmath.org
Automatic list maintenance software at majordomo at openmath.org
Mail om-owner at openmath.org for assistance with any problems



More information about the Om mailing list