python-numpy: incorrect results on i686-linux

  • Open
  • quality assurance status badge
Details
One participant
  • Diego Nicola Barbato
Owner
unassigned
Submitted by
Diego Nicola Barbato
Severity
normal
D
D
Diego Nicola Barbato wrote on 2 Jun 2020 18:16
(address . bug-guix@gnu.org)
87a71la1ev.fsf@GlaDOS.home
Hi Guix,

On i686-linux Numpy produces incorrect results for some matrix
products.

This minimal reproducer ...

Toggle snippet (11 lines)
python3 <<EOF
from numpy import array
from numpy.linalg import inv
A = array([[1. , 0. , 0. ],
[0. , 3. , 3. ],
[0. , 0. , 1. ]])
print(inv(A) @ A[:,2])
print((inv(A) @ A)[:,2])
EOF

... should return:

Toggle snippet (4 lines)
[0. 0. 1.]
[0. 0. 1.]

On x86_64-linux, armhf-linux, and aarch64-linux I get the correct
result. On i686-linux I get this instead:

Toggle snippet (4 lines)
[ 0.00000000e+00 -5.55111512e-17 1.00000000e+00]
[0. 0. 1.]

I came across this bug while looking into https://debbugs.gnu.org/40406,
for which it seems to be the underlying cause.

I'm surprised this wasn't caught by Numpy's test suite.

Regards,

Diego
?