Skip to content

Commit

Permalink
Auto merge of #27948 - wthrowe:f64-sqrt, r=alexcrichton
Browse files Browse the repository at this point in the history
This fixes a reappearance of bug #9987 introduced in
1ddee80, which caused
f64::tests::test_sqrt_domain to fail (at least on some systems).
  • Loading branch information
bors committed Aug 23, 2015
2 parents 568b13e + 5e9008d commit c69c29b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/libstd/num/f64.rs
Expand Up @@ -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).
Expand Down

0 comments on commit c69c29b

Please sign in to comment.