Handbook
Glossary
2^ ( n -- 2^n )
Factor handbook
»
The language
»
Numbers
»
Arithmetic
»
Bitwise arithmetic
Prev:
2/ ( x -- y )
Next:
bit? ( x n -- ? )
Vocabulary
math
Inputs
n
a positive integer
Outputs
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