Navigation
Synopsis Absolute value of a number.
Function &T <: num abs(&T <: num N)
Usage import util::Math;
Description Absolute value of the number n. The result type is equal to the type of the argument n.
Examples
rascal>import util::Math;
ok
rascal>abs(13)
int: 13
rascal>abs(-13)
int: 13
rascal>abs(3.14)
real: 3.14
rascal>abs(-3.14)
real: 3.14

Questions
Question [1].
The type of abs(-12) is

Question [2].
The type of abs(-7.33382863897691800) is

Question [3].
abs(-9) == 

Question [4].
abs(-6.2233224172899127) == 



Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.