Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Conklin E.K.Forth programmer's handbook.2000.pdf
Скачиваний:
321
Добавлен:
23.08.2013
Размер:
2.04 Mб
Скачать

Forth Programmer’s Handbook

UM*

( u1 u2 — ud )

Core

 

Multiply u1 by u2, leaving the double-precision result ud. All values and arith-

 

metic are unsigned. “U-M-star”

 

2.2.2

Logical and Relational Operations

 

 

 

 

 

As in the case of arithmetic operations, Forth’s implementation of logical and relational operations optimizes speed and simplicity. The words described in this section provide a rich, flexible set of logical operations.

Glossary Single-Precision Logical Operations

 

ABS

( n — +n )

Core

 

Replace the top stack item with its absolute value.

 

AND

( x1 x2 — x3 )

Core

 

Return x3, the bit-by-bit logical and of x1 with x2.

 

INVERT

( x1 — x2 )

Core

 

Invert all bits of x1, giving its logical inverse x2.

 

MAX

( n1 n2 — n3 )

Core

 

Return n3, the greater of n1 and n2.

 

MIN

( n1 n2 — n3 )

Core

 

Return n3, the lesser of n1 and n2.

 

NEGATE

( n — -n )

Core

 

Change the sign of the top stack value; if the value was negative, it becomes

 

positive. The phrase NEGATE 1- is equivalent to INVERT (one’s complement

 

of the input value).

 

OR

( x1 x2 — x3 )

Core

 

Return x3, the bit-by-bit inclusive or of x1 with x2.

 

WITHIN

( x1 x2 x3 — flag )

Core

Return true if x1 is greater than or equal to x2 and less than x3. The values may all be either unsigned integers or signed integers, but must all be the same type.

44 Forth Fundamentals

Соседние файлы в предмете Электротехника