[issue15438] Incredible issue in math.pow
Serhiy Storchaka
report at bugs.python.org
Thu Jul 26 14:53:00 CEST 2012
Serhiy Storchaka <storchaka at gmail.com> added the comment:
> - I can't find any reason in using math.pow if I can get errors like the one explained.
The reason is your intention to get the error.
>>> pow(-1, 0.5)
(6.123031769111886e-17+1j)
>>> math.pow(-1, 0.5)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
> - I've used math.h in my C++ code without having experienced any problem in that pow operation.
What you get in C++ as result of pow(43, 10)?
Technically, in C++ you should use <cmath> header, not <math.h>.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15438>
_______________________________________
More information about the Python-bugs-list
mailing list