1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! Square roots: √x, and √(1 - x²), √(1 + x²) and √(x - 1) √(x + 1) without the digits that squaring x first loses or the overflow it risks. `complex.rs` computes all four at complex arguments.
use crateNative;
/// √x, or the principal √z of a complex z, whose real part is never negative, as a function object. A negative x gives NaN.
;
/// The real part of √x, or of the principal √z of a complex z, as a function object: √x for a positive x, and 0 at or below 0. Its formula is `recipe::real_sqrt`.
;
/// The real part of √(1 - x²), or of its principal value at a complex z, as a function object: √(1 - x²) for x from -1 to 1, and 0 beyond. The real part of `0○` and `0○⁻¹`.
;
/// The real part of √(x - 1) √(x + 1), or of its principal value at a complex z, as a function object: x's sign times √(x² - 1) for |x| at least 1, and 0 between -1 and 1. The real part of `4○⁻¹`, on APL's branch.
;
/// The real part of √(-1 - x²), or of its principal value at a complex z, negated where the flag is set, as a function object: 0 for every real x, whose `8○` is imaginary. The real part of `8○`, and of `8○⁻¹` with the flag.
;
/// √(1 - x²) as √((1 - x)(1 + x)). For |x| from 1/2 to 1, the factor that nears 0 is exact, and elsewhere neither factor loses digits. A magnitude beyond 1 gives NaN.
pub
/// √(1 + x²) as the hypotenuse of x and 1, which never overflows.
pub
/// √(x - 1) √(x + 1): √(x² - 1) with the sign of x, computed as √((|x| - 1)(|x| + 1)). Where that product overflows, the root rounds to |x|. A magnitude below 1 gives NaN.
pub
;