2/ ( x -- y )
Factor handbook » The language » Numbers » Arithmetic » Bitwise arithmetic

Prev:shift ( x n -- y )
Next:2^ ( n -- 2^n )


Vocabulary
math

Inputs
xan integer


Outputs
yan integer


Word description
Shifts x to the right by one bit.

Examples
USING: math prettyprint ; 14 2/ .
7

USING: math prettyprint ; 17 2/ .
8

USING: math prettyprint ; -17 2/ .
-9


Notes
This word is not equivalent to 2 / or 2 /i; the name is historic and originates from the Forth programming language.

Definition

: 2/ ( x -- y ) -1 shift ; inline