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:
bors 2015-08-23 15:41:34 +00:00
commit c69c29bb53

View File

@ -454,7 +454,11 @@ pub fn powf(self, n: f64) -> 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).