Skip to content

Commit a809ed4

Browse files
committed
perf
1 parent 073982e commit a809ed4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/math/generic/ceil.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use super::super::{CastInto, Float};
66
pub fn ceil<F: Float>(x: F) -> F {
77
let toint = F::ONE / F::EPSILON;
88

9-
let e = x.exp_unbiased();
9+
let e = x.exp();
1010
let y: F;
1111

1212
// If the exponent exceeds
13-
if e >= F::SIG_BITS.cast() || x == F::ZERO {
13+
if e >= (F::SIG_BITS + F::EXP_BIAS).cast() || x == F::ZERO {
1414
return x;
1515
}
1616

@@ -21,7 +21,7 @@ pub fn ceil<F: Float>(x: F) -> F {
2121
y = if neg { x - toint + toint - x } else { x + toint - toint - x };
2222

2323
// special case because of non-nearest rounding modes
24-
if e < 0 {
24+
if e < F::EXP_BIAS.cast() {
2525
// Raise `FE_INEXACT`
2626
force_eval!(y);
2727
return if neg { F::NEG_ZERO } else { F::ONE };

0 commit comments

Comments
 (0)