Handbook
Glossary
abs ( x -- y )
Factor handbook
»
The language
»
Numbers
»
Mathematical functions
»
Powers and logarithms
Prev:
nth-root ( n x -- y )
Next:
absq ( x -- y )
Vocabulary
math
Inputs
x
a
number
Outputs
y
a non-negative real number
Word description
Computes the absolute value of a number.
See also
absq
Definition
IN:
math
GENERIC:
abs
( x -- y )
foldable
flushable
Methods
USING:
math
math.functions
;
M:
complex
abs
absq
sqrt
;
inline
USING:
math
;
M:
float
abs
double>bits
63
2^
bitnot
bitand
bits>double
;
inline
USING:
kernel
math
math.ratios.private
;
M:
ratio
abs
dup
neg?
[
>fraction
[
neg
]
dip
fraction>
]
when
;
USING:
kernel
math
;
M:
real
abs
dup
0
<
[
neg
]
when
;
inline