前页 | 后页 |
cabs
Complex absolute value.SYNOPSIS:
double cabs();
cmplx z;
double a;
a = cabs(&z);
DESCRIPTION:
If z = x + iy
then
a = sqrt(x**2 + y**2).
Overflow and underflow are avoided by testing the magnitudes of x and y before squaring. If either is outside half of the floating point full scale range, both are rescaled.
ACCURACY:
Relative error:
arithmetic domain # trials peak rms
DEC -30,+30 30000 3.2e-17 9.2e-18
IEEE -10,+10 100000 2.7e-16 6.9e-17
JavaScript:
var z = {"r":3.14,"i":3.14};
var a = cephes.cabs(z);
where a is an object of schema
{
"r" : double,
"i" : double
}