Handle negative numbers in sqrt properly.

Closes #9987.
This commit is contained in:
Huon Wilson
2014-10-20 11:39:01 +11:00
parent 1c3ddd2971
commit a1d5cd204d
5 changed files with 34 additions and 3 deletions

View File

@@ -1501,6 +1501,8 @@ pub trait Float: Signed + Primitive {
fn frac_1_sqrt2() -> Self;
/// Take the square root of a number.
///
/// Returns NaN if `self` is not a non-negative number.
fn sqrt(self) -> Self;
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
fn rsqrt(self) -> Self;