You are on page 1of 15

Lecture 9.

Floating Point Numbers - II


Base Arithmetics of FPU
Command: FADD receiver, source
Purpose: Addition of real numbers

Command: FADDP receiver, source


Purpose: Addition with pulling from the stack

Command: FIADD source


Purpose: Addition of integer numbers

Command: FSUB receiver, source


Purpose: Subtraction of real numbers

Command: FSUBP receiver, source


Purpose: Subtraction with pulling from the stack

Command: FISUB source


Purpose: Subtraction of integer numbers
Lecture 9. Floating Point Numbers - II
Command: FSUBR receiver, source
Purpose: Reverse subtraction of real numbers

Command: FSUBRP receiver, source


Purpose: Reverse subtraction with pulling from the stack

Command: FISUBR source


Purpose: Reverse subtraction of integer numbers

Command: FMUL receiver, source


Purpose: Multiplication of real numbers

Command: FMULP receiver, source


Purpose: Multiplication with pulling form the stack

Command: FIMUL source


Purpose: Multiplication of integer numbers
Lecture 9. Floating Point Numbers - II
Command: FDIV receiver, source
Purpose: Division of real numbers

Command: FDIVP receiver, source


Purpose: Division with pulling from the stack

Command: FIDIV source


Purpose: Division of integer numbers

Command: FDIVR receiver, source


Purpose: Reverse division of real numbers

Command: FDIVRP receiver, source


Purpose: Reverse division with pulling from the stack

Command: FIDIVR source


Purpose: Reverse division of integer numbers
Lecture 9. Floating Point Numbers - II
Command: FPREM
Purpose: Find a partial remainder of division

Command: FPREM1
Purpose: Find the partial remainder in the IEEE standard

Command: FABS
Purpose: Find absolute value

Command: FCHS
Purpose: Change a sign

Command: FRNDINT
Purpose: Round to the integer

Command: FSCALE
Purpose: Scale on two degrees
Lecture 9. Floating Point Numbers - II

Command: FXTRACT
Purpose: Extract an exhibitor and a mantissa

Command: FSQRT
Purpose: Extract a square root

Comparison commands of FPU


Command: FCOM source
Purpose: Compare real numbers

Command: FCOMP source


Purpose: Compare and pull from the stack

Command: FCOMPP source


Purpose: Compare and pull two numbers from the stack
Lecture 9. Floating Point Numbers - II
Table. Comparison flags of FPU

Command: FUCOM source


Purpose: Compare real numbers without degrees

Command: FUCOMP source


Purpose: Compare without degrees and pull from the stack

Command: FUCOMPP source


Purpose: Compare without degrees and pull two numbers
from the stack
Lecture 9. Floating Point Numbers - II
Command: FICOM source
Purpose: Compare integer numbers

Command: FICOMP source


Purpose: Compare integer numbers and pull from the stack

Command: FCOMI source


Purpose: Compare and establish EFLAGS

Command: FCOMIP source


Purpose: Compare, establish EFLAGS and pull from the
stack
Command: FUCOMI source
Purpose: Compare without degrees and establish EFLAGS

Command: FUCOMIP source


Purpose: Compare without degrees, establish EFLAGS and
pull from the stack
Lecture 9. Floating Point Numbers - II
Table. Flags after FCOMI commands

Command: FTST
Purpose: Check, whether ST(0) contains zero

Command: FXAM
Purpose: Analyze content of ST(0)
Table. Results of FXAM command
Lecture 9. Floating Point Numbers - II

Transcendental operations of FPU


Command: FSIN
Purpose: Sine

Command: FCOS
Purpose: Cosine

Command: FSINCOS
Purpose: Sine and cosine

Command: FPTAN
Purpose: Tangent

Command: FPATAN
Purpose: Arctangent
Lecture 9. Floating Point Numbers - II
Table. Results of FPATAN command

Command: F2XMI
Purpose: Calculating 2^x - 1

Command: FYL2X
Purpose: Calculating y*log2(x)

Command: FYL2XP1
Purpose: Calculating y*log2(x + 1)
Lecture 9. Floating Point Numbers - II

Constants of FPU

Command: FLD1
Purpose: Push 1.0 onto the stack
Command: FLDZ
Purpose: Push +0.0 onto the stack
Command: FLDPI
Purpose: Push PI number onto the stack
Command: FLDL2E
Purpose: Push log2(e) onto the stack
Command: FLDL2T
Purpose: Push log2(10) onto the stack
Command: FLDLN2
Purpose: Push ln(2) onto the stack
Command: FLDLG2
Purpose: Push lg(2) onto the stack
Lecture 9. Floating Point Numbers - II
Control command of FPU
Command: FINCSTP
Purpose: Increase the top index of the stack

Command: FDECSTP
Purpose: Reduce the top index of the stack

Command: FFREE operand


Purpose: Empty the data register

Command: FINIT
Purpose: Initialize FPU

Command: FNINIT
Purpose: Initialize FPU without expectation

Command: FCLEX
Purpose: Nullify exception flags
Lecture 9. Floating Point Numbers - II
Command: FNCLEX
Purpose: Nullify exception flags without expectation

Command: FSTCW receiver


Purpose: Save the register CR

Command: FNSTCW receiver


Purpose: Save the register CR without expectation

Command: FLDCW source


Purpose: Load the register CR

Command: FSTENV receiver


Purpose: Save auxiliary registers

Command: FNSTENV receiver


Purpose: Save auxiliary registers without expectation
Lecture 9. Floating Point Numbers - II
Command: FLDENV source
Purpose: Load auxiliary registers

Command: FSAVE receiver


Purpose: Save FPU condition

Command: FNSAVE receiver


Purpose: Save FPU condition without expectation

Command: FXSAVE receiver


Purpose: Fast saving FPU condition

Command: FRSTOR source


Purpose: Restore FPU condition

Command: FXRSTOR source


Purpose: Fast saving FPU condition
Lecture 9. Floating Point Numbers - II

Command: FSTSW receiver


Purpose: Save the register SR

Command: FNSTSW receiver


Purpose: Save the register SR without expectation

Command: WAIT
FWAIT
Purpose: Expectation of FPU readiness

Command: FNOP
Purpose: Lack of operation

You might also like