Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 8

cabs(), cabsf()

Compute the absolute value of a complex number

Synopsis:

#include <math.h>

struct __cabsargs {
    double  x;   /* real part      */
    double  y;   /* imaginary part */
};

double cabs( struct __cabsargs value );

struct __cabsfargs {
    float  x;   /* real part      */
    float  y;   /* imaginary part */
};

float cabsf( struct __cabsfargs value );

Arguments:

value
The complex value that you want to get the absolute value of.

Library:

libm

Use the -l m option to qcc to link against this library.

Description:

These functions compute the absolute value of the complex number specified by value, using a calculation equivalent to:

sqrt( ( value.x * value.x ) + ( value.y * value.y ) );

Returns:

The absolute value of value.

Examples:

#include <stdio.h>
#include <math.h>
#include <stdlib.h>

struct __cabsargs c = { -3.0, 4.0 };

int main( void )
{
    printf( "%f\n", cabs( c ) );

    return EXIT_SUCCESS;
}

produces the output:

5.000000

Classification:

ANSI, POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

abs(), fabs(), labs()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 154

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/cabs.html on line 154