Skip to content

fpu: canonicalize sqrt NaN results - #301

Open
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fsqrt-nan-canonicalize
Open

fpu: canonicalize sqrt NaN results#301
carlosqwqqwq wants to merge 1 commit into
LekKit:stagingfrom
carlosqwqqwq:fix/fsqrt-nan-canonicalize

Conversation

@carlosqwqqwq

Copy link
Copy Markdown

fpu: canonicalize sqrt NaN results

Fixes #292

Commit message

fpu: canonicalize sqrt NaN results

Description

The fsqrt.s and fsqrt.d wrappers test the sign before classifying NaNs. Positive qNaNs therefore return their payload unchanged, and signaling NaNs do not consistently raise NV. Handle NaNs first, canonicalize both precisions, and raise invalid only when the input is signaling. The existing negative finite-input and signed-zero behavior remains unchanged.

Validation

  • Native RISC-V hardware and QEMU return the canonical qNaN for qNaN inputs and set NV for signaling NaNs; the patched build matches on the single- and double-precision witness matrix.

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.

fsqrt.s/fsqrt.d preserve NaN payloads and miss NV for signaling NaNs

1 participant