Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
truncate ( x -- y )
Factor documentation
>
Factor handbook
>
The language
>
Numbers
>
Mathematical functions
>
Arithmetic functions
Prev:
floor ( x -- y )
Next:
round ( x -- y )
Vocabulary
math.functions
Inputs and outputs
x
a
real
y
a whole real number
Word description
Outputs the number that results from subtracting the fractional component of
x
.
Notes
The result is not necessarily an integer.
Definition
USING:
kernel
math
;
IN:
math.functions
:
truncate
( x -- y )
dup
1
mod
-
;
inline