Run rustfmt
This commit is contained in:
parent
9cf8475f2f
commit
47a543171c
8 changed files with 23 additions and 24 deletions
|
|
@ -267,22 +267,17 @@ mod musl_reference_tests {
|
|||
.status()
|
||||
.unwrap();
|
||||
assert!(status.success());
|
||||
let output = Command::new("./gen")
|
||||
.current_dir(&dst)
|
||||
.output()
|
||||
.unwrap();
|
||||
let output = Command::new("./gen").current_dir(&dst).output().unwrap();
|
||||
assert!(output.status.success());
|
||||
assert!(output.stderr.is_empty());
|
||||
|
||||
// Map all the output bytes back to an `i64` and then shove it all into
|
||||
// the expected results.
|
||||
let mut results =
|
||||
output.stdout.chunks_exact(8)
|
||||
.map(|buf| {
|
||||
let mut exact = [0; 8];
|
||||
exact.copy_from_slice(buf);
|
||||
i64::from_le_bytes(exact)
|
||||
});
|
||||
let mut results = output.stdout.chunks_exact(8).map(|buf| {
|
||||
let mut exact = [0; 8];
|
||||
exact.copy_from_slice(buf);
|
||||
i64::from_le_bytes(exact)
|
||||
});
|
||||
|
||||
for test in functions.iter_mut().flat_map(|f| f.tests.iter_mut()) {
|
||||
test.output = results.next().unwrap();
|
||||
|
|
@ -301,7 +296,10 @@ mod musl_reference_tests {
|
|||
src.push_str("fn ");
|
||||
src.push_str(&function.name);
|
||||
src.push_str("_matches_musl() {");
|
||||
src.push_str(&format!("static TESTS: &[([i64; {}], i64)]", function.args.len()));
|
||||
src.push_str(&format!(
|
||||
"static TESTS: &[([i64; {}], i64)]",
|
||||
function.args.len()
|
||||
));
|
||||
src.push_str(" = &[");
|
||||
for test in function.tests.iter() {
|
||||
src.push_str("([");
|
||||
|
|
@ -336,9 +334,11 @@ mod musl_reference_tests {
|
|||
Ty::Bool => unreachable!(),
|
||||
});
|
||||
|
||||
src.push_str(r#"
|
||||
src.push_str(
|
||||
r#"
|
||||
panic!("INPUT: {:?} EXPECTED: {:?} ACTUAL {:?}", test, expected, output);
|
||||
"#);
|
||||
"#,
|
||||
);
|
||||
src.push_str("}");
|
||||
|
||||
src.push_str("}");
|
||||
|
|
|
|||
|
|
@ -148,7 +148,8 @@ mod tests {
|
|||
(-3.0_f64.sqrt() / 3.0, -f64::consts::FRAC_PI_6),
|
||||
(-1.0, -f64::consts::FRAC_PI_4),
|
||||
(-3.0_f64.sqrt(), -f64::consts::FRAC_PI_3),
|
||||
].iter()
|
||||
]
|
||||
.iter()
|
||||
{
|
||||
assert!(
|
||||
(atan(*input) - answer) / answer < 1e-5,
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ const P2: f32 = -2.7667332906e-3; /* -0xb55215.0p-32 */
|
|||
pub fn expf(mut x: f32) -> f32 {
|
||||
let x1p127 = f32::from_bits(0x7f000000); // 0x1p127f === 2 ^ 127
|
||||
let x1p_126 = f32::from_bits(0x800000); // 0x1p-126f === 2 ^ -126 /*original 0x1p-149f ??????????? */
|
||||
|
||||
let mut hx = x.to_bits();
|
||||
let sign = (hx >> 31) as i32; /* sign bit of x */
|
||||
let signb: bool = sign != 0;
|
||||
|
|
|
|||
|
|
@ -166,13 +166,13 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
|
|||
}
|
||||
if r == c {
|
||||
/* min normal after rounding, underflow depends
|
||||
on arch behaviour which can be imitated by
|
||||
a double to float conversion */
|
||||
on arch behaviour which can be imitated by
|
||||
a double to float conversion */
|
||||
let fltmin: f32 = (x0_ffffff8p_63 * f32::MIN_POSITIVE as f64 * r) as f32;
|
||||
return f64::MIN_POSITIVE / f32::MIN_POSITIVE as f64 * fltmin as f64;
|
||||
}
|
||||
/* one bit is lost when scaled, add another top bit to
|
||||
only round once at conversion if it is inexact */
|
||||
only round once at conversion if it is inexact */
|
||||
if (rhi << 53) != 0 {
|
||||
i = (rhi >> 1 | (rhi & 1) | 1 << 62) as i64;
|
||||
if sign != 0 {
|
||||
|
|
@ -182,7 +182,7 @@ pub fn fma(x: f64, y: f64, z: f64) -> f64 {
|
|||
r = 2. * r - c; /* remove top bit */
|
||||
|
||||
/* raise underflow portably, such that it
|
||||
cannot be optimized away */
|
||||
cannot be optimized away */
|
||||
{
|
||||
let tiny: f64 = f64::MIN_POSITIVE / f32::MIN_POSITIVE as f64 * r;
|
||||
r += (tiny * tiny) * (r - r);
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ pub fn pow(x: f64, y: f64) -> f64 {
|
|||
}
|
||||
|
||||
/* now |1-x| is TINY <= 2**-20, suffice to compute
|
||||
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
||||
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
||||
let t: f64 = ax - 1.0; /* t has 20 trailing zeros */
|
||||
let w: f64 = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25));
|
||||
let u: f64 = IVLN2_H * t; /* ivln2_h has 21 sig. bits */
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ pub fn powf(x: f32, y: f32) -> f32 {
|
|||
}
|
||||
|
||||
/* now |1-x| is TINY <= 2**-20, suffice to compute
|
||||
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
||||
log(x) by x-x^2/2+x^3/3-x^4/4 */
|
||||
t = ax - 1.; /* t has 20 trailing zeros */
|
||||
w = (t * t) * (0.5 - t * (0.333333333333 - t * 0.25));
|
||||
u = IVLN2_H * t; /* IVLN2_H has 16 sig. bits */
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
// ====================================================
|
||||
//
|
||||
// Optimized by Bruce D. Evans. */
|
||||
|
||||
use super::rem_pio2_large;
|
||||
|
||||
// #if FLT_EVAL_METHOD==0 || FLT_EVAL_METHOD==1
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ pub fn scalbn(x: f64, mut n: i32) -> f64 {
|
|||
}
|
||||
} else if n < -1022 {
|
||||
/* make sure final n < -53 to avoid double
|
||||
rounding in the subnormal range */
|
||||
rounding in the subnormal range */
|
||||
y *= x1p_1022 * x1p53;
|
||||
n += 1022 - 53;
|
||||
if n < -1022 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue