<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Dec 22, 2015 at 12:55 AM, Peter Creasey <span dir="ltr"><<a href="mailto:p.e.creasey.00@googlemail.com" target="_blank">p.e.creasey.00@googlemail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi all,<br>
I submitted a PR (#6872) for using complex numbers in np.lib.interp.<br>
<br>
The tests pass on my machine, but I see that the TravisCI builds are<br>
giving assertion fails (on my own test) with python 3.3 and 3.5 of the<br>
form:<br>
> assert_almost_equal<br>
> TypeError: Cannot cast array data from dtype('complex128') to dtype('float64') according to the rule 'safe'<br>
<br>
When I was writing the test I used np.testing.assert_almost_equal with<br>
complex128 as it works in my python 2.7, however having checked the<br>
docstring I cannot tell what the expected behaviour should be (complex<br>
or no complex allowed). Should my test be changed or the<br>
assert_almost_equal?<br></blockquote><div><br></div><div>Hi Peter, that error is unrelated to assert_almost_equal. What happens is that when you pass in a complex argument `fp` to your modified `compiled_interp`, you're somewhere doing a cast that's not safe and trigger the error at <a href="https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/ctors.c#L1930">https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/ctors.c#L1930</a>. For what "safe casting" means, see <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.can_cast.html">http://docs.scipy.org/doc/numpy/reference/generated/numpy.can_cast.html</a><br><br></div><div>Ralf<br><br></div></div></div></div>