Skip to content

Conversation

@leftmostcat
Copy link

Objective

Fixes #5152.

Solution

Use f32::total_cmp() for ordering and f32::to_bits() for hashing.

Testing

Tested via existing unit tests. This may impact several parts of the engine which use FloatOrd for sorting, as sorting of NaNs has changed. These paths have not been tested.

Notes

This is a potentially significant behavioral change for FloatOrd and should likely be included in a breaking release if accepted.

@github-actions
Copy link
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨

@IQuick143 IQuick143 added A-Math Fundamental domain-agnostic mathematical operations D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward C-Code-Quality A section of code that is hard to understand or change labels Dec 23, 2025
@mockersf
Copy link
Member

I tried this some years ago when it was stabilised, and it had negative performance impacts. Could you check?

@mockersf mockersf added the S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help label Dec 24, 2025
@leftmostcat
Copy link
Author

I tried this some years ago when it was stabilised, and it had negative performance impacts. Could you check?

Is there a specific area where this caused problems, or a specific means I should use for benching?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Math Fundamental domain-agnostic mathematical operations C-Code-Quality A section of code that is hard to understand or change D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Benchmarking This set of changes needs performance benchmarking to double-check that they help S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use the freshly stabilized f32::total_cmp methods

3 participants