abs

Function abs 

Source
pub fn abs(args: &[Value]) -> Result<Value, RuntimeError>
Expand description

绝对值

§功能

返回数字的绝对值(非负值)。

§参数

  • x: Number - 输入数字

§返回值

Number - 输入数字的绝对值

§公式

|x| = { x  if x ≥ 0
      {-x  if x < 0

§示例

Set a Abs(-5)           # 5
Set b Abs(3.14)         # 3.14
Set c Abs(-42.7)        # 42.7