about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorOliver Middleton <olliemail27@gmail.com>2020-01-04 23:44:19 +0000
committerOliver Middleton <olliemail27@gmail.com>2020-01-04 23:44:19 +0000
commita35b4234df9815e7741aff8fe7cc4dfde12dcc2c (patch)
treeaced5bbfada5f2b7193bf1b985d6db0837ae2f24 /src/libstd
parentcd8377d37e9bc47f9a5a982c41705a7800cbb51d (diff)
downloadrust-a35b4234df9815e7741aff8fe7cc4dfde12dcc2c.tar.gz
rust-a35b4234df9815e7741aff8fe7cc4dfde12dcc2c.zip
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.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/f32.rs2
-rw-r--r--src/libstd/f64.rs2
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).