Auto merge of #27948 - wthrowe:f64-sqrt, r=alexcrichton
This fixes a reappearance of bug #9987 introduced in
1ddee8070d, which caused
f64::tests::test_sqrt_domain to fail (at least on some systems).
This commit is contained in:
commit
c69c29bb53
1 changed files with 5 additions and 1 deletions
|
|
@ -454,7 +454,11 @@ impl f64 {
|
|||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
#[inline]
|
||||
pub fn sqrt(self) -> f64 {
|
||||
unsafe { intrinsics::sqrtf64(self) }
|
||||
if self < 0.0 {
|
||||
NAN
|
||||
} else {
|
||||
unsafe { intrinsics::sqrtf64(self) }
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns `e^(self)`, (the exponential function).
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue