Skip to content

Latest commit

 

History

History
77 lines (56 loc) · 2.18 KB

File metadata and controls

77 lines (56 loc) · 2.18 KB
descriptiontitlems.dateapi_nameapi_locationapi_typetopic_typef1_keywordshelpviewer_keywordsms.assetid
Learn more about: _cabs
_cabs
4/2/2020
_cabs
_o__cabs
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-math-l1-1-0.dll
DLLExport
apiref
_cabs
cabs function
absolute values
_cabs function
calculating absolute values
fea292ee-1a39-4a0a-b416-4a189346ff26

_cabs

Calculates the absolute value of a complex number.

Syntax

double_cabs( struct_complexz );

Parameters

z
Complex number.

Return value

_cabs returns the absolute value of its argument if successful. On overflow, _cabs returns HUGE_VAL and sets errno to ERANGE. You can change error handling with _matherr.

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 component x and an imaginary component y. A call to _cabs produces a value equivalent to that of the expression sqrt( z.x * z.x + z.y * z.y ).

By default, this function's global state is scoped to the application. To change this behavior, see Global state in the CRT.

Requirements

RoutineRequired header
_cabs<math.h>

For more compatibility information, see Compatibility.

Example

// crt_cabs.c// Using _cabs, this program calculates// the absolute value of a complex number.#include<math.h>#include<stdio.h>intmain( void ) { struct_complexnumber= { 3.0, 4.0 }; doubled; d=_cabs( number ); printf( "The absolute value of %f + %fi is %f\n", number.x, number.y, d ); }
The absolute value of 3.000000 + 4.000000i is 5.000000 

See also

Math and floating-point support
abs, labs, llabs, _abs64
fabs, fabsf, fabsl

close