🌐
TutorialsPoint
tutorialspoint.com › c_standard_library › c_function_fabs.htm
C library - fabs() function
The C math library fabs() function accepts the parameter(x) of type double that returns the absolute value of x. This function is defined under the header that calculates the absolute value of a float point number.
🌐
GeeksforGeeks
geeksforgeeks.org › c language › fabs-function-in-c
fabs() Function in C - GeeksforGeeks
July 23, 2025 - fabs() function of math.h header file in C programming is used to get the absolute value of a floating point number.
🌐
GeeksforGeeks
geeksforgeeks.org › c++ › fabs-in-c
fabs() in C++ - GeeksforGeeks
January 31, 2023 - The fabs() function returns the absolute value of the argument. Mathematically |a|. If a is value given in the argument.
🌐
W3Schools
w3schools.com › c › ref_math_fabs.php
C Math fabs() Function
The fabs() function returns the absolute (positive) value of a number.
🌐
W3Schools
w3schools.com › python › ref_math_fabs.asp
Python math.fabs() Method
The math.fabs() method returns the absolute value of a number, as a float.
🌐
O'Reilly
oreilly.com › library › view › c-in-a › 0596006977 › re57.html
fabs - C in a Nutshell [Book]
December 16, 2005 - The fabs() function returns the absolute value of its floating-point argument x; if x is greater than or equal to 0, the return value is equal to x.
Authors   Peter PrinzTony Crawford
Published   2005
Pages   618
Find elsewhere
🌐
Codecademy
codecademy.com › docs › c++ › math functions › fabs()
C++ (C Plus Plus) | Math Functions | fabs() | Codecademy
April 13, 2025 - The fabs() function in C++ calculates and returns the absolute value of a floating-point number. It returns the non-negative value of the input, effectively converting any negative number to its positive equivalent.
🌐
Scaler
scaler.com › home › topics › fabs() function in c
fabs() Function in C - Scaler Topics
November 7, 2023 - The fabs in C is a library function provided within the math.h header file of the C programming language.
🌐
Educative
educative.io › answers › what-is-the-fabs-function-in-cpp
What is the fabs() function in C++?
The fabs() function in C++ is used to return the absolute value of an argument passed to the function.
🌐
MKSSoftware
mkssoftware.com › docs › man3 › fabs.3.asp
fabs(), fabsf() -- floating-point absolute value function
fabs() function computes the absolute value of a floating-point number x. The · fabsf() function is a single-precision version of · fabs(). x · Is a floating point value. The · fabs() function returns the absolute value of x. If x is NaN, NaN is returned.
🌐
NCL
ncl.ucar.edu › Document › Functions › Built-in › fabs.shtml
fabs
function fabs ( value : float or double ) return_val [dimsizes(value)] : float or double
🌐
The Open Group
pubs.opengroup.org › onlinepubs › 009696899 › functions › fabs.html
fabs
Upon successful completion, these functions shall return the absolute value of x. ... If x is ±0, +0 shall be returned. If x is ±Inf, +Inf shall be returned. No errors are defined. The following sections are informative. This example shows the use of fabs() to compute the 1-norm of a vector ...
🌐
Vultr
docs.vultr.com › clang › standard-library › math-h › fabs
C math.h fabs() - Get Absolute Value | Vultr Docs
December 12, 2024 - The fabs() function from the C standard library's math.h header file is used to compute the absolute value of a floating-point number.
🌐
Stack Overflow
stackoverflow.com › questions › 77073189 › homemade-fabs-function-in-c-and-x86-assembly
Homemade 'fabs' function in C and x86 Assembly - Stack Overflow
#include <math.h> #include <stdio.h> typedef union { float v; struct { int mantissa : 23; int exponent : 8; int negative : 1; } b; } components; float fabs1(float f) { return f >= 0.0 ? f : -f; } float fabs2(float f) { components c; c.v = f; c.b.negative = 0; return c.v; } float fabs3(float f) { double aux = f; unsigned short cw; __asm__ ( "finit;\ fstcw %[cw];\ andw $0xf0ff, %[cw];\ orw $0x0200, %[cw];\ fldcw %[cw];\ fldl %[aux];\ fabs;\ fstpl %[aux];" : [aux] "=mr" (aux) : "m" (aux), [cw] "m" (cw) ); return aux; } void main(void) { printf("fabs(-189.55f) = %f\n", fabs(-189.55f)); printf("fabs1(-189.55f) = %f\n", fabs1(-189.55f)); printf("fabs2(-189.55f) = %f\n", fabs2(-189.55f)); printf("fabs3(-189.55f) = %f\n", fabs3(-189.55f)); } There are three different functions, one using a simple decision, one a bit more complicated using unions, and a final one using x86 assembly.