Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <math.h>
    double cabs( struct complex value );

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

Description:
    The cabs function computes the absolute value of the complex number
    value by a calculation which is equivalent to

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

    In certain cases, overflow errors may occur which will cause the
     matherr routine to be invoked.

Returns:
    The absolute value is returned.

Example:
    #include <stdio.h>
    #include <math.h>

    struct _complex c = { -3.0, 4.0 };

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

    produces the following:

    5.000000

Classification:
    WATCOM

Systems:
    Math

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson