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.
This commit is contained in:
Oliver Middleton
2020-01-04 23:44:19 +00:00
parent cd8377d37e
commit a35b4234df
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -376,7 +376,7 @@ pub fn powf(self, n: f32) -> 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).
+1 -1
View File
@@ -342,7 +342,7 @@ pub fn powf(self, n: f64) -> 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).