diff options
| author | Dylan DPC <dylan.dpc@gmail.com> | 2020-01-05 22:44:32 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-05 22:44:32 +0530 |
| commit | eae08b25a6da51eac515a270c4216324901057a6 (patch) | |
| tree | 5057e28336014cef89dcf0bf9cfce447321058fb | |
| parent | 59f8ba3a4e7f43be18e400e83c146bc87975cd4b (diff) | |
| parent | a35b4234df9815e7741aff8fe7cc4dfde12dcc2c (diff) | |
| download | rust-eae08b25a6da51eac515a270c4216324901057a6.tar.gz rust-eae08b25a6da51eac515a270c4216324901057a6.zip | |
Rollup merge of #67879 - ollie27:float_sqrt_neg, r=rkruppe
Remove negative number check from float sqrt It hasn't been UB to pass negative numbers to sqrt since https://reviews.llvm.org/D28797 which was included in LLVM 5.
| -rw-r--r-- | src/libstd/f32.rs | 2 | ||||
| -rw-r--r-- | src/libstd/f64.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs index 54e0caeddaa..267d7013b1e 100644 --- a/src/libstd/f32.rs +++ b/src/libstd/f32.rs @@ -376,7 +376,7 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn sqrt(self) -> f32 { - if self < 0.0 { NAN } else { unsafe { intrinsics::sqrtf32(self) } } + unsafe { intrinsics::sqrtf32(self) } } /// Returns `e^(self)`, (the exponential function). diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index aa32e5fb998..61ce7b29e26 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -342,7 +342,7 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn sqrt(self) -> f64 { - if self < 0.0 { NAN } else { unsafe { intrinsics::sqrtf64(self) } } + unsafe { intrinsics::sqrtf64(self) } } /// Returns `e^(self)`, (the exponential function). |
