Added negative cases for asinh
according to IEEE-754.
This commit is contained in:
parent
92f08b78a1
commit
c4569347b2
@ -908,10 +908,17 @@ impl f32 {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asinh(self) -> f32 {
|
||||
if self == NEG_INFINITY {
|
||||
NEG_INFINITY
|
||||
} else {
|
||||
(self + ((self * self) + 1.0).sqrt()).ln()
|
||||
match self {
|
||||
x if x == NEG_INFINITY => NEG_INFINITY,
|
||||
x if x.is_sign_negative() => {
|
||||
let v = (x + ((x * x) + 1.0).sqrt()).ln();
|
||||
if v.is_sign_negative() {
|
||||
v
|
||||
} else {
|
||||
-v
|
||||
}
|
||||
}
|
||||
x => (x + ((x * x) + 1.0).sqrt()).ln()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -831,10 +831,17 @@ impl f64 {
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn asinh(self) -> f64 {
|
||||
if self == NEG_INFINITY {
|
||||
NEG_INFINITY
|
||||
} else {
|
||||
(self + ((self * self) + 1.0).sqrt()).ln()
|
||||
match self {
|
||||
x if x == NEG_INFINITY => NEG_INFINITY,
|
||||
x if x.is_sign_negative() => {
|
||||
let v = (x + ((x * x) + 1.0).sqrt()).ln();
|
||||
if v.is_sign_negative() {
|
||||
v
|
||||
} else {
|
||||
-v
|
||||
}
|
||||
}
|
||||
x => (x + ((x * x) + 1.0).sqrt()).ln()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user