<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


D>> Search:

In Math Words in 32-bit library

Word Name: D>>
Type: Standard word
Data Stack Signature: ud:x s:count – d:y
Return Stack Signature: --
Availability: V1.2
Description:

Performs a logical shift of the double value x right by count bits, yielding the double value y.

Example:

-3200. DABS 5 D>> DNEGATE D. (displays -100)
 3200. 5 D>> D. (displays 100)
-3200. 5 D>> D. (displays 134217628)

Comment:

The value x halves with each shift. Zeros are shifted in from the most significant bit, meaning the sign of the value could change. Note that count is a single value, not a double.

Care should be taken when shifting signed values (or rather, values that are to be interpreted as signed values) since the sign of the value (as dictated by the most significant bit) may change as a result of the shift.

See Also: >> 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>