shunwang / numexpr

Automatically exported from code.google.com/p/numexpr
MIT License
0 stars 0 forks source link

Modulus with 0 and integer array causes floating point exception #107

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Running numexpr v2.1 and numpy 1.7, if you try the following code, causes a 
floating point exception that causes the entire interpreter to crash

>>> import numpy as np
>>> import numexpr
>>> arr = np.arange(-5,5)
>>> numexpr.evaluate("arr % 0", {"arr": arr})

Note that this does not crash if converted to a float (at least in this 
example):

>>> arr = arr + 0.
>>> numexpr.evaluate("arr % 0", {"arr": arr})

This exception occurs whether or not truediv is active in the calling scope (or 
`truediv=true` is passed).

What is the expected output? What do you see instead?

Numpy produces a runtime warning and outputs zeros, if you use a float, outputs 
`nan`. Definitely should not crash.

What version of the product are you using? On what operating system?
Mac OS X 10.8, Python 2.7

Please provide any additional information below.

Original issue reported on code.google.com by jtrat...@gmail.com on 10 Jun 2013 at 7:55

GoogleCodeExporter commented 9 years ago
Side note, this also occurs on Travis CI too (from builds of pandas using 
numexpr)

Original comment by jtrat...@gmail.com on 10 Jun 2013 at 7:59

GoogleCodeExporter commented 9 years ago

Original comment by gdemen...@gmail.com on 12 Jun 2013 at 12:29

GoogleCodeExporter commented 9 years ago
Fixed in rev 34b8d6d6a97a.

Original comment by fal...@gmail.com on 26 Aug 2013 at 5:36

GoogleCodeExporter commented 9 years ago
Thanks for fixing this!

Original comment by jtrat...@gmail.com on 30 Aug 2013 at 10:44