Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (51 sloc) 1.85 KB
title ms.date apiname apilocation apitype f1_keywords helpviewer_keywords ms.assetid
fabs, fabsf, fabsl
04/05/2018
fabsf
fabs
fabsl
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
fabs
fabsf
fabsl
math abs
math absf
math absl
absolute values
fabsf function
calculating absolute values
fabs function
fabsl function
23bca210-f408-4f5e-b46b-0ccaaec31e36

fabs, fabsf, fabsl

Calculates the absolute value of the floating-point argument.

Syntax

double fabs(
   double x
);
float fabs(
   float x
); // C++ only
long double fabs(
   long double x
); // C++ only
float fabsf(
   float x
);
long double fabsl(
   long double x
);

Parameters

x
Floating-point value.

Return Value

The fabs functions return the absolute value of the argument x. There is no error return.

Input SEH Exception Matherr Exception
± QNAN,IND none _DOMAIN

Remarks

C++ allows overloading, so you can call overloads of fabs if you include the <cmath> header. In a C program, fabs always takes and returns a double.

Requirements

Function Required C header Required C++ header
fabs, fabsf, fabsl <math.h> <cmath> or <math.h>

For additional compatibility information, see Compatibility.

Example

See the example for abs.

See also

Floating-Point Support
abs, labs, llabs, _abs64
_cabs

You can’t perform that action at this time.