UMBC CMSC 211

UMBC | CSEE


Floating Point Arithmetic

The FPU is a stack machine. Arithmetic is performed by pushing the two operands onto the stack, and then exectuing an arithmetic opcode, which in effect pops the two top items, does the operation with the the two values and then pushs the result back on the stack.
fadd ST + ST(1)
fsub ST - ST(1)
fsubr ST(1) - ST
fmul ST X ST(1)
fdiv ST / ST(1)
fdivf ST(1) / ST
These can have the letter p appended.

Some FPU Miscellaneous Arithmetic

  fabs            ; Absolute value     Set ST to |ST|
  fchs            ; Chage sign of ST.  Set ST to -ST
  fsqrt           ; Square root.       Set ST to sqrt(ST)


UMBC | CSEE