fabs . math . sncode
latest
This function computes the absolute value of a float.
FABS(1e)
NAME
fabs - This function computes the absolute value of a float.
SYNOPSIS
fabs (argument)
DESCRIPTION
This mathematical function allows the user to compute the absolute value of a float. The absolute value is equivalent to the modulo of the number, its positive value. It resemblances a distance. If the argument is a float or an integer, the function will simply return its positive value.
PARAMETERS
- NUMBER
- Specify the number (float) used as argument for the fabs function.
RETURN
- The fabs value of the argument.
EXAMPLES
Note: In the followings examples, the _ between the { should be removed to make it work.
One can use this function with integers: test(q(res={_{fabs(-2);}}.),q(res=2.)); test(q(res={_{fabs(2);}}.),q(res=2.)); With floats: test(q(res={_{fabs(-999.9);}}.),q(res=999.9.)); With defined variables: test(q(res={_{ %include "/includes/extenso.sn"; fabs(-PI); }}.), q(res=PI.)); One another variable: test(q(res={_{ %include "/includes/extenso.sn"; a=-3.1; fabs(a); }}.), q(res=3.1.)); With a trigonometric function : test(q(res={_{ %include "/includes/extenso.sn"; a=cos(PI); fabs(a); }}.), q(res=1.)); With an array: test(q(res={_{fabs(-1,2.5,-2.5);}}.),q(res=\[1,2.5,2.5\].));
AUTHOR
Written by Caroline Laplante, <claplante@sednove.com>