From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/c/numeric%2Fcomplex%2Fcabs.html | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 devdocs/c/numeric%2Fcomplex%2Fcabs.html (limited to 'devdocs/c/numeric%2Fcomplex%2Fcabs.html') diff --git a/devdocs/c/numeric%2Fcomplex%2Fcabs.html b/devdocs/c/numeric%2Fcomplex%2Fcabs.html new file mode 100644 index 00000000..5db11848 --- /dev/null +++ b/devdocs/c/numeric%2Fcomplex%2Fcabs.html @@ -0,0 +1,47 @@ +

cabsf, cabs, cabsl

Defined in header <complex.h>
float       cabsf( float complex z );
+
(1) (since C99)
double      cabs( double complex z );
+
(2) (since C99)
long double cabsl( long double complex z );
+
(3) (since C99)
Defined in header <tgmath.h>
#define fabs( z )
+
(4) (since C99)
+1-3) Computes the complex absolute value (also known as norm, modulus, or magnitude) of z.
+4) Type-generic macro: if z has type long double complex or long double imaginary, cabsl is called. If z has type float complex or float imaginary, cabsf is called. If z has type double complex or double imaginary, cabs is called. For real and integer types, the corresponding version of fabs is called.

Parameters

+ +
z - complex argument

Return value

If no errors occur, returns the absolute value (norm, magnitude) of z.

+

Errors and special cases are handled as if the function is implemented as hypot(creal(z), cimag(z))

+

Example

#include <stdio.h>
+#include <complex.h>
+ 
+int main(void)
+{
+    double complex z = 1.0 + 1.0*I;
+    printf("%.1f%+.1fi cartesian is rho=%f theta=%f polar\n",
+           creal(z), cimag(z), cabs(z), carg(z));
+}

Output:

+
1.0+1.0i cartesian is rho=1.414214 theta=0.785398 polar

References

See also

+ + + + +
+
(C99)(C99)(C99)
computes the phase angle of a complex number
(function)
+
(C99)
computes absolute value of an integral value (\(\small{|x|}\)|x|)
(function)
+
(C99)(C99)
computes absolute value of a floating-point value (\(\small{|x|}\)|x|)
(function)
+
(C99)(C99)(C99)
computes square root of the sum of the squares of two given numbers (\(\scriptsize{\sqrt{x^2+y^2} }\)x2+y2)
(function)
C++ documentation for abs
+

+ © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
+ https://en.cppreference.com/w/c/numeric/complex/cabs +

+
-- cgit v1.2.3