grammar
ABS (digital)
The ABS function syntax has the following parameters:
$ Number requires a real number whose absolute value needs to be calculated. Generally speaking, ABS functions are more nested with other functions. For example, using ABS function combined with IF function can judge whether each student's last test score and this test score are progressing or regressing.
Extended data
Abs function in C++. When using abs function in C++, it should be noted that there are two versions, one is defined in stdlib.h and the other is defined in cmath header file. Actually, the file stdlib.h is a function of C, while the version in cmath is C++.
According to the ISO C/C++ standard, the abs function of C language only supports the calculation of the absolute value of integers, and fabs must be used to obtain the absolute value of floating-point numbers. Abs in C++ can naturally support both integer and floating-point versions (in fact, it can also support complex numbers).
If the C version of abs function is inadvertently used in the C++ program because of the header file, and a floating-point number with a decimal point is input, its behavior may not meet the programmer's expectation, because the floating-point number will be truncated and converted into an integer when the function parameters are passed in.
Baidu encyclopedia -ABS function