Abs Function | |
Return the absolute value of a numeric expression, regardless of its sign.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION Abs(
nValue AS USUAL
) AS USUAL
public static Usual Abs(
Usual nValue
)
Request Example
View SourceParameters
- nValue
- Type: Usual
The numeric expression to evaluate.
Return Value
Type:
Usual
A positive number or 0.
Remarks
Absolute value is the same as nValue if nValue is greater than or equal to 0.
It is the negation of nValue if nValue is less than 0.
Abs() lets you get the difference between the magnitude of
two numbers, where magnitude is the distance from the origin or zero.
Examples
These examples show typical results from Abs():
1nNum1 := 100
2nNum2 := 150
3? nNum1 - nNum2
4? ABS(nNum1 - nNum2)
5? ABS(nNum2 - nNum1)
6? ABS(-12)
7? ABS(0)
8nSouth := -5
9nNorth := 4
10? ABS(nSouth) - ABS(nNorth)
11? ABS(nSouth) > ABS(nNorth)
12? nSouth > nNorth
See Also