mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-07 01:05:39 +03:00
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:
+1
-1
@@ -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
@@ -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).
|
||||
|
||||
Reference in New Issue
Block a user