fix traits

This commit is contained in:
Andrey Zgarbul
2019-05-09 07:36:52 +03:00
parent 61e38098d9
commit 9f0bc49652
2 changed files with 28 additions and 44 deletions
+10 -10
View File
@@ -41,18 +41,18 @@ mod musl_reference_tests {
"rem_pio2.rs",
"rem_pio2_large.rs",
"rem_pio2f.rs",
"remquo.rs", // more than 1 result
"remquof.rs", // more than 1 result
"remquo.rs", // more than 1 result
"remquof.rs", // more than 1 result
"lgamma_r.rs", // more than 1 result
"lgammaf_r.rs", // more than 1 result
"frexp.rs", // more than 1 result
"frexpf.rs", // more than 1 result
"sincos.rs", // more than 1 result
"sincosf.rs", // more than 1 result
"modf.rs", // more than 1 result
"modff.rs", // more than 1 result
"jn.rs", // passed, but very slow
"jnf.rs", // passed, but very slow
"frexp.rs", // more than 1 result
"frexpf.rs", // more than 1 result
"sincos.rs", // more than 1 result
"sincosf.rs", // more than 1 result
"modf.rs", // more than 1 result
"modff.rs", // more than 1 result
"jn.rs", // passed, but very slow
"jnf.rs", // passed, but very slow
];
struct Function {
+18 -34
View File
@@ -119,13 +119,7 @@ pub trait F32Ext: private::Sealed + Sized {
fn atan2(self, other: Self) -> Self;
#[inline]
fn sin_cos(self) -> (Self, Self)
where
Self: Copy,
{
(self.sin(), self.cos())
}
fn sin_cos(self) -> (Self, Self);
fn exp_m1(self) -> Self;
@@ -289,6 +283,11 @@ impl F32Ext for f32 {
atan2f(self, other)
}
#[inline]
fn sin_cos(self) -> (Self, Self) {
sincosf(self)
}
#[inline]
fn exp_m1(self) -> Self {
expm1f(self)
@@ -316,24 +315,17 @@ impl F32Ext for f32 {
#[inline]
fn asinh(self) -> Self {
if self == f32::NEG_INFINITY {
f32::NEG_INFINITY
} else {
(self + ((self * self) + 1.0).sqrt()).ln()
}
asinhf(self)
}
#[inline]
fn acosh(self) -> Self {
match self {
x if x < 1.0 => f32::NAN,
x => (x + ((x * x) - 1.0).sqrt()).ln(),
}
acoshf(self)
}
#[inline]
fn atanh(self) -> Self {
0.5 * ((2.0 * self) / (1.0 - self)).ln_1p()
atanhf(self)
}
}
@@ -401,13 +393,7 @@ pub trait F64Ext: private::Sealed + Sized {
fn atan2(self, other: Self) -> Self;
#[inline]
fn sin_cos(self) -> (Self, Self)
where
Self: Copy,
{
(self.sin(), self.cos())
}
fn sin_cos(self) -> (Self, Self);
fn exp_m1(self) -> Self;
@@ -571,6 +557,11 @@ impl F64Ext for f64 {
atan2(self, other)
}
#[inline]
fn sin_cos(self) -> (Self, Self) {
sincos(self)
}
#[inline]
fn exp_m1(self) -> Self {
expm1(self)
@@ -598,24 +589,17 @@ impl F64Ext for f64 {
#[inline]
fn asinh(self) -> Self {
if self == f64::NEG_INFINITY {
f64::NEG_INFINITY
} else {
(self + ((self * self) + 1.0).sqrt()).ln()
}
asinh(self)
}
#[inline]
fn acosh(self) -> Self {
match self {
x if x < 1.0 => f64::NAN,
x => (x + ((x * x) - 1.0).sqrt()).ln(),
}
acosh(self)
}
#[inline]
fn atanh(self) -> Self {
0.5 * ((2.0 * self) / (1.0 - self)).ln_1p()
atanh(self)
}
}