"Christophe" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> [EMAIL PROTECTED] a écrit :

> Floating point numbers just don't have the required precision to represent 
> 2.0 - 1e-050. For your specific problem, if you really want the result to 
> be < 2.0, the the best you can do is admit that floating point operations 
> have errors and return 0.0 when the modulus operation equals 2.0.

I disagree.  For any two floating-point numbers a and b, with b != 0, it is 
always possible to represent the exact value of a mod b as a floating-point 
number--at least on every floating-point system I have ever encountered. 
The implementation is not even that difficult.


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to