Skip to content

x87: Manually raise FE_OVERFLOW/FE_UNDERFLOW flags in LD2D conversion#3472

Merged
ptitSeb merged 1 commit intoptitSeb:mainfrom
yzewei:fenv_ovf
Feb 6, 2026
Merged

x87: Manually raise FE_OVERFLOW/FE_UNDERFLOW flags in LD2D conversion#3472
ptitSeb merged 1 commit intoptitSeb:mainfrom
yzewei:fenv_ovf

Conversation

@yzewei
Copy link
Contributor

@yzewei yzewei commented Feb 6, 2026

Problem Description (Motivation): The Python NumPy software is throwing an error: A library relying on the fenv flag to detect precision loss failed in testing (test_identity_long_short).

The current LD2D (long double to double) conversion logic is implemented through integer bitwise operations. Because it doesn't involve host FPU hardware instructions, the CPU hardware doesn't automatically set the floating-point status register flags when a value overflows or underflows occurs.

Result: The NumPy exception detection issue has been fixed.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
@ptitSeb
Copy link
Owner

ptitSeb commented Feb 6, 2026

It's a bit strange to update global status flags but not x87 status register but ok.

@ptitSeb ptitSeb merged commit ba1b73d into ptitSeb:main Feb 6, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants