Wrong results when calculating power with an array
See original GitHub issueSince Numba 0.38.0, the following function leads to wrong results:
import numpy as np
import numba as nb
def test(a, b):
return (1. / a) ** b
test_nb = nb.njit(test)
Example:
>>> test_nb(0.1 * np.ones(50), np.ones(50))
array([ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 10., 10.])
Expected output (with NumPy):
>>> test(0.1 * np.ones(50), np.ones(50))
array([10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.,
10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.,
10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.,
10., 10., 10., 10., 10., 10., 10., 10., 10., 10., 10.])
I have only encountered this bug on Windows, and it does not occur on Numba 0.37.0. Relevant output from conda list
:
llvmlite 0.23.0 py36_1 conda-forge
numba 0.38.0 py36h830ac7b_0
numpy 1.14.2 py36h5c71026_0
python 3.6.0 0
Let me know if you need more information.
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Array formula gives wrong answer - Microsoft Community
I'm using an array formula to find the best match for some data, where one column must definitely match. Here is the formula:...
Read more >c++ - Problem with getting calculations of an array inside of an ...
The problem seems to be in the arrays of the last block in the code, it keeps returning wrong results of the tan(x)...
Read more >Excel array formula examples for beginners and advanced users
If your array formula returns an incorrect result, make sure you pressed Ctrl + Shift + Enter when entering it. If you did,...
Read more >Why Excel Formula giving Wrong Answers? - MyExcelOnline
2. Show Formula button is turned on. If your formula is displaying the function instead of the calculated result, it is because the...
Read more >Excel Formulas Not Working: Possible Reasons and How to ...
As you can see that this formula gives an error in some cases. This happens because I haven't locked the table array argument...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dionhaefner thanks for the report. Given what you present, please could you try setting the environment variable
NUMBA_DISABLE_INTEL_SVML
to non-zero and re-running. I’m suggesting this as Windows 64 bit is the only platform with SVML by default and it appeared in 0.38. Thanks.Are we sure that the problem is only Windows? If the conda-forge llvmlite is installed on a Linux box with SVML present, what happens?
I’m worried that instead we need to be able to detect when llvmlite has been linked against an unpatched LLVM (regardless of platform), and then disable SVML support in that case, regardless of whether the library is present.