Share via


_cabs (Windows CE 5.0)

Send Feedback

Developing an Application > Microsoft C Run-time Library for Windows CE > Run-time Library Reference

Calculates the absolute value of a complex number.

double _cabs(   struct _complexz);

Parameters

  • z
    Complex number.

Return Values

If successful, _cabs returns the absolute value of its argument.

On overflow, _cabs returns HUGE_VAL.

Remarks

The _cabs function calculates the absolute value of a complex number, which must be a structure of type _complex.

The structure z is composed of a real element x and an imaginary element y.

A call to _cabs produces a value equivalent to that of the expression sqrt( z.x*z.x + z.y*z.y ).

Example

/* CABS.C: Using _cabs, this program calculates
 * the absolute value of a complex number.
 */
void main( void )
{
   struct _complex number = { 3.0, 4.0 };
   double d;

   d = _cabs( number );
   printf( "The absolute value of %f + %fi is %f\n",
           number.x, number.y, d );
}

Output

The absolute value of 3.000000 + 4.000000i is 5.000000

Requirements

OS Versions: Windows CE 2.0 and later.
Header: stdlib.h.
Link Library: coredll.dll.

See Also

abs | fabs | labs

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.