[geos-devel] QD (Quad-Double) Approach to Robustness

Martin Davis mbdavis at VividSolutions.com
Wed Jun 14 19:32:10 EDT 2006


> Float point arithmetic in IA-32 CPUs is not compatible with 
> IEEE 754. Here is what I was told by one of my friend that 
> knows this issue well:
> 
> CPU always uses extended double irrespective of settings of 
> accuracy. The float value is converted only when the data is 
> going to be saved from FPU stack to the memory.

Thank you and your colleague for the clarification, Mateusz.  There's
some more info on this problem with reference to robustness of geometric
algorithms from J Shewchuk here:
http://www.cs.cmu.edu/afs/cs/project/quake/public/www/robust.pc.html
(And of course QD has some code to address this issue too - it was based
on Shewchuk's work.

Unfortunately, AFAIK it's not possible to work around this in Java.   So
I'm going to have to think of some other way to deal with the need for
extended precision.  Some ideas are in the works, but nothing that
deliverable yet.

Martin Davis, Senior Technical Architect
Vivid Solutions Inc.      www.vividsolutions.com
Suite #1A-2328 Government Street Victoria, B.C. V8T 5G5
Phone: (250) 385 6040 - Local 308 Fax: (250) 385 6046


> -----Original Message-----
> From: geos-devel-bounces at geos.refractions.net 
> [mailto:geos-devel-bounces at geos.refractions.net] On Behalf Of 
> Mateusz Loskot
> Sent: June 14, 2006 2:51 PM
> To: GEOS Development List
> Subject: Re: [geos-devel] QD (Quad-Double) Approach to Robustness
> 
> 
> Martin Davis wrote:
> > Here's the Java spec on use of FP numbers:
> > 
> > 
> http://java.sun.com/docs/books/jls/second_edition/html/types>
Values.doc
> > .h
> > tml#9249
> > 
> > It always uses IEEE754 format.  But as I understand it, IEEE754 has 
> > some subtle complexities involving rounding modes and 
> hidden bits on 
> > some platforms (e.g. Intel), so even this pretty detailed 
> spec may not 
> > mean that evey Java implementation computes in exactly the same way.
> 

> 
> 
> Note also to Sandro:
> And here, in case of inlining, can force usage of thread 
> stack to pass arguments instead of FPU registers. That can be 
> the inlining/not inlining issues that Sandro has revealed.
> 
> 
> Cheers
> -- 
> Mateusz Loskot
> http://mateusz.loskot.net 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net 
> http://geos.refractions.net/mailman/listinfo/geos-devel
> 



More information about the geos-devel mailing list