feat: add wasm float min/max/nearest operations to runtime#28
Merged
Conversation
Add implementations of Wasm float operations: - f32.min, f32.max (with NaN propagation and ±0.0 handling) - f64.min, f64.max (with NaN propagation and ±0.0 handling) - f32.nearest (banker's rounding without libm dependency) - f64.nearest (banker's rounding without libm dependency) All operations follow Wasm spec semantics: - NaN input → NaN output - min(-0.0, +0.0) = -0.0; max(-0.0, +0.0) = +0.0 - Nearest uses banker's rounding (round-to-even) These are no_std compatible and require no heap allocation. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds Wasm float operations to the runtime library:
f32.min,f32.maxwith NaN propagation and ±0.0 semanticsf64.min,f64.maxwith NaN propagation and ±0.0 semanticsf32.nearestandf64.nearestusing banker's rounding (round-to-even)All operations are
no_stdcompatible and follow Wasm specification semantics exactly.Notes
libmdependency by using integer truncation on sub-2^23/2^52 values🤖 Generated with Claude Code