Skip to content

Commit be80629

Browse files
quaternictgross35
authored andcommitted
remove uses of Ord::clamp in scalbn
1 parent 13f972f commit be80629

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libm/src/math/generic/scalbn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,14 @@ where
9696
// Work aroudn this by using a different algorithm that calculates the prescale
9797
// dynamically based on the maximum possible value. This adds more operations per round
9898
// since it needs to construct the scale, but works better in the general case.
99-
let add = -(n + sig_total_bits as i32).clamp(exp_min, sig_total_bits as i32);
99+
let add = -(n + sig_total_bits as i32).max(exp_min);
100100
let mul = F::from_parts(false, (F::EXP_BIAS as i32 - add) as u32, zero);
101101

102102
x *= mul;
103103
n += add;
104104

105105
if n < exp_min {
106-
let add = -(n + sig_total_bits as i32).clamp(exp_min, sig_total_bits as i32);
106+
let add = -(n + sig_total_bits as i32).max(exp_min);
107107
let mul = F::from_parts(false, (F::EXP_BIAS as i32 - add) as u32, zero);
108108

109109
x *= mul;

0 commit comments

Comments
 (0)