[issue34645] math and numpy yield different results (nan)

Steven D'Aprano report at bugs.python.org
Wed Sep 12 14:19:04 EDT 2018


Steven D'Aprano <steve+python at pearwood.info> added the comment:

> Well, the thing is that i pass two (apparent) identical values into the same function,

Even if they have the same *numeric* value, they aren't the same kind of 
value, and they aren't the same function.

One is <type 'numpy.float64'> and the other is <class 'float'>. When you 
call ** (exponentiation), that calls two different methods. One raises 
a warning and returns NAN, the other converts to complex.

This has nothing to do with linspace. See my simplifed example code 
which doesn't use it.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34645>
_______________________________________


More information about the Python-bugs-list mailing list