fmod and %
Zunbeltz Izaola
zunbeltz at wm.lc.ehu.es.XXX
Wed Apr 21 05:56:43 EDT 2004
Hi,
I have a problem with % operation. It returns a incorrect value in
this case:
>>> -2.77555756156e-17%1
1.0
where the returned value should be -2.77555756156e-17.
The documentation says that there is same errors due to roundoff and
suggest to use fmod from math module.
>>> fmod( -2.77555756156e-17,1)
-2.77555756156e-17
Ok, but when i try the following:
>>> fmod(-0.32768000000000003,1)
-0.32768000000000003
but i want to get the result % gives
>>> -0.32768000000000003%1
0.67232000000000003
what is going wrong? Any suggestions
Thanks in advance
--
Zunbeltz Izaola
More information about the Python-list
mailing list