Very basic question:
in my python 2.7
code I have situation roughly as follows:
b=5.0*10**(-9)
a=9
print(a)
c=a/(1.0*b)
the code runs in python
/ spyder
(64bit), but fails in Cython
, because of a float division by 0. The printed number is 0. When I define
b=0.000000005
the division is fine and the printed number, too. What is the error?
I can reproduce your error with cython 0.22
and I think this error is related to this thread at cython-users
.
It seems that cython
gets into trouble when calculating 10**-9
. If you use 10**-9.0
instead, everything works fine.
Note, that you could get rid of the error and prettify the code snippet by replacing 5.0*10**(-9)
by 5e-9
.
Nevertheless this seems to be a bug in cython
and not in your code base.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With