Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TST: Fix test_numeric on riscv64 #25618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion numpy/core/tests/test_numeric.py
Original file line number Diff line number Diff line change
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