fix jn, ilogb
This commit is contained in:
parent
68c49a2362
commit
62e2506745
4
build.rs
4
build.rs
@ -26,9 +26,7 @@ mod musl_reference_tests {
|
||||
|
||||
// These files are all internal functions or otherwise miscellaneous, not
|
||||
// defining a function we want to test.
|
||||
const IGNORED_FILES: &[&str] = &[
|
||||
"fenv.rs",
|
||||
];
|
||||
const IGNORED_FILES: &[&str] = &["fenv.rs"];
|
||||
|
||||
struct Function {
|
||||
name: String,
|
||||
|
@ -1,4 +1,4 @@
|
||||
const FP_ILOGBNAN: i32 = -1 - ((!0) >> 1);
|
||||
const FP_ILOGBNAN: i32 = -1 - 0x7fffffff;
|
||||
const FP_ILOGB0: i32 = FP_ILOGBNAN;
|
||||
|
||||
pub fn ilogb(x: f64) -> i32 {
|
||||
@ -17,15 +17,15 @@ pub fn ilogb(x: f64) -> i32 {
|
||||
e -= 1;
|
||||
i <<= 1;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
if e == 0x7ff {
|
||||
e
|
||||
} else if e == 0x7ff {
|
||||
force_eval!(0.0 / 0.0);
|
||||
if (i << 12) != 0 {
|
||||
return FP_ILOGBNAN;
|
||||
FP_ILOGBNAN
|
||||
} else {
|
||||
return i32::max_value();
|
||||
i32::max_value()
|
||||
}
|
||||
} else {
|
||||
e - 0x3ff
|
||||
}
|
||||
return e - 0x3ff;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
const FP_ILOGBNAN: i32 = -1 - ((!0) >> 1);
|
||||
const FP_ILOGBNAN: i32 = -1 - 0x7fffffff;
|
||||
const FP_ILOGB0: i32 = FP_ILOGBNAN;
|
||||
|
||||
pub fn ilogbf(x: f32) -> i32 {
|
||||
@ -17,15 +17,15 @@ pub fn ilogbf(x: f32) -> i32 {
|
||||
e -= 1;
|
||||
i <<= 1;
|
||||
}
|
||||
return e;
|
||||
}
|
||||
if e == 0xff {
|
||||
e
|
||||
} else if e == 0xff {
|
||||
force_eval!(0.0 / 0.0);
|
||||
if (i << 9) != 0 {
|
||||
return FP_ILOGBNAN;
|
||||
FP_ILOGBNAN
|
||||
} else {
|
||||
return i32::max_value();
|
||||
i32::max_value()
|
||||
}
|
||||
} else {
|
||||
e - 0x7f
|
||||
}
|
||||
return e - 0x7f;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ pub fn jn(n: i32, mut x: f64) -> f64 {
|
||||
ix &= 0x7fffffff;
|
||||
|
||||
// -lx == !lx + 1
|
||||
if (ix | (lx | (!lx + 1)) >> 31) > 0x7ff00000 {
|
||||
if (ix | (lx | ((!lx).wrapping_add(1))) >> 31) > 0x7ff00000 {
|
||||
/* nan */
|
||||
return x;
|
||||
}
|
||||
@ -268,7 +268,7 @@ pub fn yn(n: i32, x: f64) -> f64 {
|
||||
ix &= 0x7fffffff;
|
||||
|
||||
// -lx == !lx + 1
|
||||
if (ix | (lx | (!lx + 1)) >> 31) > 0x7ff00000 {
|
||||
if (ix | (lx | ((!lx).wrapping_add(1))) >> 31) > 0x7ff00000 {
|
||||
/* nan */
|
||||
return x;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user