Hi,<div><br></div><div>I have terrible performance for multiplication when one number gets very close to zero. I'm using cython by writing the following code:</div><div><div><br></div><div> cdef int i </div><div> cdef double x = 1.0 </div>
<div> for 0 <= i < 10000000: </div><div> x *= 0.8 </div><div> #x += 0.01 </div><div> print x </div></div><div><br></div><div>This code runs much much slower (20+ times slower) with the line x += 0.01 uncommented. I looked at the deassembled code and it looks correct. Moreover, it's just a few lines and by writing a C code (without python on top), I get the same code, but it's much faster. I've also tried using sse, but I get exactly the same behavior. The best candidate that I see so far is that Python sets up the FPU in a different state than C.</div>
<div><br></div><div>Any advice on how to solve this performance problem?</div><div><br></div><div>thanks!</div>