question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong results when calculating power with an array

See original GitHub issue

Since 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:closed
  • Created 5 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stuartarchibaldcommented, May 29, 2018

@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.

0reactions
seibertcommented, May 30, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found