lz_root_2
The square root.
long lz_root_2( CLZNumber* leftOperand, CLZNumber* targetNumber = nullptr );
Correctly rounded, by Newton–Raphson, and at wide widths by the arithmetic-geometric mean's own square root. A root that ends is answered short: the square root of 0.0001 is 0.01. A value exactly on a half is decided exactly.
The root of a negative number is refused, kFailed, flagged not-a-number; lzc_root_2 gives the complex one.
Examples
| Call | Answer | Returns |
|---|---|---|
lz_root_2( 2 ) | 1.414213562373095048801688724209698079 | kNoError |
lz_root_2( 2 ) 50 places | 1.41421356237309504880168872420969807856967187537695 | kNoError |
lz_root_2( 0.0001 ) | 0.01 | kNoError |
lz_root_2( −9 ) | not a number | kFailed |
Each answer is what Addaptic printed for the call, at 36 places unless a setting is shown.
Returns
kNoError (0) when the answer is written. Otherwise an error code, with the answer flagged infinite or not-a-number; see Errors and flags.
See also
lz_root_3The cube root.lz_root_nThe root of the left number whose order is the right.lzc_root_2The principal square root of a complex number.