Skip to content

Commit

Permalink
Merge pull request #25618 from charris/backport-25430
Browse files Browse the repository at this point in the history
TST: Fix test_numeric on riscv64
  • Loading branch information
charris committed Jan 18, 2024
2 parents 623a403 + f4e606a commit 59c97a0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion numpy/core/tests/test_numeric.py
Expand Up @@ -477,7 +477,14 @@ def setup_method(self):
self.signd[self.ed] *= -1.
self.signf[1::6][self.ef[1::6]] = -np.inf
self.signd[1::6][self.ed[1::6]] = -np.inf
self.signf[3::6][self.ef[3::6]] = -np.nan
# On RISC-V, many operations that produce NaNs, such as converting
# a -NaN from f64 to f32, return a canonical NaN. The canonical
# NaNs are always positive. See section 11.3 NaN Generation and
# Propagation of the RISC-V Unprivileged ISA for more details.
# We disable the float32 sign test on riscv64 for -np.nan as the sign
# of the NaN will be lost when it's converted to a float32.
if platform.processor() != 'riscv64':
self.signf[3::6][self.ef[3::6]] = -np.nan
self.signd[3::6][self.ed[3::6]] = -np.nan
self.signf[4::6][self.ef[4::6]] = -0.
self.signd[4::6][self.ed[4::6]] = -0.
Expand Down

0 comments on commit 59c97a0

Please sign in to comment.