Factor Documentation
|
Home
|
Glossary
|
Search
factorcode.org
2^ ( n -- 2^n )
Factor documentation
>
Factor handbook
>
The language
>
Numbers
>
Arithmetic
>
Bitwise arithmetic
Prev:
2/ ( x -- y )
Next:
bit? ( x n -- ? )
Vocabulary
math
Inputs and outputs
n
a positive integer
2^n
a positive integer
Word description
Computes two to the power of
n
. This word will only give correct results if
n
is greater than zero; for the general case, use
2 swap ^
.
Definition
USING:
kernel
;
IN:
math
:
2^
( n -- 2^n )
1
swap
shift
;
inline