[Numpy-discussion] floating point arithmetic issue

Guillaume Chérel guillaume.c.cherel@gmail....
Fri Jul 30 07:21:23 CDT 2010


Thanks for all your answers and the references (and yes, I have to admit 
that I've been a bit lazy with Goldberg's article, though it looks very 

But as numpy is designed for scientific computing, is there no 
implementation of an "exact type" 
(http://floating-point-gui.de/formats/exact/) to avoid floating point 

As for the details about my problem, I'm trying to compute the total 
surface of overlapping disks. I approximate the surface with a grid and 
count how many points of the grid fall into at least one disk. I use the 
mod operator in a calculation to find the coordinates of the left-most 
point of the grid that falls into a given disk, and I do that for all 
disks. I need to use floating point numbers with this modulo operator 
because I want the resolution of the grid is arbitrary.

I suppose my explanation might not be very straightforward, so if you 
know of another good way to compute the surface of overlapping disks, 
I'd be glad to know.


Le 30/07/2010 13:21, Pauli Virtanen a écrit :
> Fri, 30 Jul 2010 19:52:37 +0900, David wrote:
> [clip]
>> Indeed, it is not, and that's expected. There are various pitfalls using
>> floating point. Rational and explanations:
>> http://docs.sun.com/source/806-3568/ncg_goldberg.html
> In case of tl;dr, see also http://floating-point-gui.de/

More information about the NumPy-Discussion mailing list