Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
>integer ( x -- n )
Factor documentation
>
Factor handbook
>
The language
>
Numbers
>
Integers
Prev:
>fixnum ( x -- n )
Next:
>bignum ( x -- n )
Vocabulary
math
Inputs and outputs
x
a
real
n
a
bignum
Word description
Converts a real number to an integer, with a possible loss of precision.
Definition
IN:
math
GENERIC:
>integer
( x -- n )
foldable
flushable
Methods
USING:
kernel
layouts
math
math.order
;
M:
bignum
>integer
dup
most-negative-fixnum
most-positive-fixnum
between?
[
>fixnum
]
when
;
USING:
math
;
M:
fixnum
>integer
;
inline
USING:
kernel
layouts
math
math.order
;
M:
real
>integer
dup
most-negative-fixnum
most-positive-fixnum
between?
[
>fixnum
]
[
>bignum
]
if
;
inline