The commands listed in Table 4-5 perform single-precision arithmetic.

Table 4-5 Single-Precision Arithmetic Functions
Command |
Stack Diagram |
Description |
---|---|---|

+ |
( nu1 nu2 -- sum ) |
Adds |

- |
( nu1 nu2 -- diff ) |
Subtracts |

* |
( nu1 nu2 -- prod ) |
Multiplies |

*/ |
( n1 n2 n3 -- quot ) |
Calculates |

/ |
( n1 n2 -- quot ) |
Divides |

1+ |
( nu1 -- nu2 ) |
Adds one. |

1- |
( nu1 -- nu2 ) |
Subtracts one. |

2+ |
( nu1 -- nu2 ) |
Adds two. |

2- |
( nu1 -- nu2 ) |
Subtracts two. |

abs |
( n -- u ) |
Absolute value. |

bounds |
( start len -- len+start start ) |
Converts start,len to end,start for |

even |
( n -- n | n+1 ) |
Round to nearest even integer >= |

max |
( n1 n2 -- n3 ) |
n3 is maximum of n1 and n2 |

min |
( n1 n2 -- n3 ) |
n3 is minimum of n1 and n2 |

mod |
( n1 n2 -- rem ) |
Remainder of |

*/mod |
( n1 n2 n3 -- rem quot ) |
Remainder, quotient of |

/mod |
( n1 n2 -- rem quot ) |
Remainder, quotient of |

negate |
( n1 -- n2 ) |
Change the sign of |

u* |
(u1 u2 -- uprod ) |
Multiply 2 unsigned numbers yielding an unsigned product. |

u/mod |
( u1 u2 -- urem uquot ) |
Divide unsigned one-cell number by an unsigned one-cell number; yield one-cell remainder and quotient. |

<< |
( x1 u -- x2 ) |
Synonym for |

>> |
( x1 u -- x2 ) |
Synonym for |

2* |
( x1 -- x2 ) |
Multiply by 2. |

2/ |
( x1 -- x2 ) |
Divide by 2. |

>>a |
( x1 u -- x2 ) |
Arithmetic right-shift |

and |
( x1 x2 -- x3 ) |
Bitwise logical AND. |

invert |
( x1 -- x2 ) |
Invert all bits of |

lshift |
( x1 u -- x2 ) |
Left-shift |

not |
( x1 -- x2 ) |
Synonym for |

or |
( x1 x2 -- x3 ) |
Bitwise logical OR. |

rshift |
( x1 u -- x2 ) |
Right-shift |

u2/ |
( x1 -- x2 ) |
Logical right shift 1 bit; zero shifted into high bit. |

xor |
( x1 x2 -- x3 ) |
Bitwise exclusive OR. |

- © 2010, Oracle Corporation and/or its affiliates