Skip to content

Conversation

@quaternic
Copy link
Contributor

@quaternic quaternic commented Dec 14, 2025

Avoid using Ord::clamp in the f16-specific part of the generic scalbn.

fixes #1046

It turned out to be redundant anyway, as both callsites follow a pattern like

if n < negative_val {
    let foo = (n + positive_val).clamp(negative_val, positive_val);
}

and n < negative_val < 0 implies n + positive_val < positive_val.

@zmodem
Copy link

zmodem commented Dec 16, 2025

Is this ready for review? Do we need to add someone?

@tgross35 tgross35 enabled auto-merge (squash) December 16, 2025 22:05
Copy link
Contributor

@tgross35 tgross35 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tgross35 tgross35 force-pushed the scalbnf16-redundant-clamp branch from 95ace8b to be80629 Compare December 17, 2025 05:16
@rustbot
Copy link
Collaborator

rustbot commented Dec 17, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@tgross35 tgross35 merged commit 5b44b47 into rust-lang:main Dec 17, 2025
39 checks passed
@quaternic quaternic deleted the scalbnf16-redundant-clamp branch December 17, 2025 06:02
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.

Change to Ord::clamp causes build errors by calling through upstream monomorphisations

4 participants