Skip to content

math: flt reads an f32-backed input directly (skip the double hop)#12

Merged
NiceAndPeter merged 1 commit into
mainfrom
math-flt-f32-input
Jun 22, 2026
Merged

math: flt reads an f32-backed input directly (skip the double hop)#12
NiceAndPeter merged 1 commit into
mainfrom
math-flt-f32-input

Conversation

@NiceAndPeter

Copy link
Copy Markdown
Owner

Follow-up — close the last soft-double hop on flt input

The float engine narrowed every input via bound → double → float. For an f32-backed operand the raw is already a binary32 value, so flt::to_float now reads x.raw() directly; any other storage still decodes via double then narrows.

  • Pure optimization — no value change: float → double → float round-trips to the same float, so the flt golden pins are unchanged.
  • Keeps the whole flt + f32 path in hardware float on a single-precision FPU — no soft-double at the input boundary (the output side already stored directly). This is the input half of the perf question from earlier.
  • The 18 cores and the inline sqrt/pow/tan flt branches route through to_float; the Lower/Upper<Out> overflow thresholds stay compile-time rational→double constants.

(Caught and fixed a self-recursion the helper picked up from an over-broad sed during development — the segfault is gone, confirmed by the full suite.)

Verified: default 407/407, CORDIC 443/443, FLOAT 398/398.

🤖 Generated with Claude Code

The float engine narrowed every input via bound→double→float. For an f32-backed
operand the raw IS already a binary32 value, so `flt::to_float` now reads
`x.raw()` directly; any other storage still decodes via double then narrows.
float→double→float round-trips to the same float, so this is a pure optimization
— no value change (the flt golden pins are unchanged) — that keeps the whole
flt+f32 path in hardware float on a single-precision FPU (no soft-double at the
input boundary). The 18 cores and the inline sqrt/pow/tan flt branches route
through `to_float`; the Lower/Upper<Out> overflow thresholds stay compile-time
rational→double constants.

Verified: default 407/407, CORDIC 443/443, FLOAT 398/398.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NiceAndPeter NiceAndPeter merged commit a85633c into main Jun 22, 2026
17 checks passed
@NiceAndPeter NiceAndPeter deleted the math-flt-f32-input branch June 22, 2026 20:20
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.

1 participant