Many programming languages have functions that calculate absolute values of numbers, either having the name abs or Abs. In languages such as C, it has variants for long integers and floating point numbers called labs and fabs. All the functions take a signed number as a parameter, and returns the absolute value of that number in the same datatype.
A very possible implementation of the abs functions, written in pseudo-code, would be:
function abs (number n) {
if n >= 0 return n;
else return -n;
}
Abs functions. Their prototypes are listed as follows.
Due to REALbasic's automatic numeric type conversion, other method signatures are not needed.
This article is licensed under the GNU Free Documentation License.
It uses material from the
"Abs (programming)".
Home Page • arts • business • computers • games • health • hospitals • home • kids & teens • news • physicians • recreation• reference • regional • science • shopping • society • sports • world