Skip to content
This repository was archived by the owner on Apr 28, 2025. It is now read-only.

Commit 57c0dec

Browse files
committed
clippy
1 parent eefbd98 commit 57c0dec

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

crates/libm-test/src/domain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<F: Float, I: Int> EitherPrim<Domain<F>, Domain<I>> {
171171
Box::new((0..u8::MAX).map(|scale| {
172172
let mut base = F::ZERO;
173173
for _ in 0..scale {
174-
base = base - F::ONE;
174+
base -= F::ONE;
175175
}
176176
base
177177
}))

src/math/cbrt.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,12 @@ where
2323
let one = F::Int::ONE;
2424
let u0: F = F::U0;
2525
let u1: F = F::U1;
26-
let rsc = F::RSC;
2726
let off = F::OFF;
2827

2928
/* rm=0 for rounding to nearest, and other values for directed roundings */
3029
let hx = x.to_bits();
3130
let mut mant: F::Int = hx & F::SIG_MASK;
32-
let sign: F::Int = hx >> (F::BITS - 1);
31+
let sign: F::Int = hx & F::SIGN_MASK;
3332
let neg = x.is_sign_negative();
3433

3534
let mut e: u32 = x.exp();
@@ -61,19 +60,19 @@ where
6160

6261
/* 2^(3k+it) <= x < 2^(3k+it+1), with 0 <= it <= 3 */
6362
cvt5 += F::Int::cast_from(it) << F::SIG_BITS;
64-
cvt5 |= sign << (F::BITS - 1);
63+
cvt5 |= sign;
6564
let zz: F = F::from_bits(cvt5);
6665

6766
/* cbrt(x) = cbrt(zz)*2^(et-1365) where 1 <= zz < 8 */
6867
let mut isc = F::ESCALE[it as usize].to_bits(); // todo: index
69-
isc |= sign << (F::BITS - 1);
68+
isc |= sign;
7069
let cvt2 = isc;
7170
let z: F = F::from_bits(cvt1);
7271

7372
/* cbrt(zz) = cbrt(z)*isc, where isc encodes 1, 2^(1/3) or 2^(2/3),
7473
and 1 <= z < 2 */
7574
let r: F = F::ONE / z;
76-
let rr: F = r * rsc[((it as usize) << 1) | neg as usize];
75+
let rr: F = r * F::RSC[((it as usize) << 1) | neg as usize];
7776
let z2: F = z * z;
7877
let c0: F = F::C[0] + z * F::C[1];
7978
let c2: F = F::C[2] + z * F::C[3];
@@ -155,7 +154,7 @@ where
155154
if round != Round::Nearest {
156155
for (a, b) in F::WLIST {
157156
if azz == a {
158-
let tmp = if F::Int::from(round as u8) + sign == F::Int::cast_from(2) {
157+
let tmp = if F::Int::from(round as u8 + neg as u8) == F::Int::cast_from(2) {
159158
F::TWO_POW_NEG_SIG_BITS
160159
} else {
161160
F::ZERO

0 commit comments

Comments
 (0)