$absolute
Welcome to our Knowledge Base
Documentation | Blog | Demos | Support
< All Topics
Print
$absolute
0 out of 5 stars
5 Stars | 0% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
Returns the absolute value of a number.
Syntax
$absolute(number)
where
number | a number, or an expression that evaluates to a number |
Return Value
Number, positive, with the same number of decimal places as number.
Comments
Use $absolute to ensure that a number is positive (for functions such as $sqrt, for example). $absolute returns the absolute (unsigned) value of a number. The absolute value is always treated as positive.
Example
Certain functions – for example, $sqrt – accept only positive arguments. You can use $absolute to ensure that all arguments to these functions are positive.
$sqrt($absolute(-0.98))
evaluates as if it were:
$sqrt(0.98)
See Also
Updated
ByJason Lee
Was this article helpful?
0 out of 5 stars
5 Stars | 0% | |
4 Stars | 0% | |
3 Stars | 0% | |
2 Stars | 0% | |
1 Stars | 0% |
5