Skip to content

Commit dc83b57

Browse files
committed
debug assert the assumed positivity
1 parent 57ecf53 commit dc83b57

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

libm/src/math/rem_pio2_large.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,8 +271,10 @@ pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) ->
271271
fw = 0f64;
272272
for j in 0..=jx {
273273
fw += i!(x, j) * i!(f, jx + i - j);
274+
debug_assert!(x[j].is_sign_positive());
274275
}
275276
i!(q, i, =, fw);
277+
debug_assert!(q[i].is_sign_positive());
276278
}
277279

278280
let mut jz = jk;
@@ -290,6 +292,7 @@ pub(crate) fn rem_pio2_large(x: &[f64], y: &mut [f64], e0: i32, prec: usize) ->
290292

291293
/* compute n */
292294
z = scalbn(z, q0); /* actual value of z */
295+
debug_assert!(z.is_sign_positive());
293296
z -= 8.0 * trunc(z * 0.125); /* trim off integer >= 8 */
294297
n = z as i32;
295298
z -= n as f64;

0 commit comments

Comments
 (0)