1 / 12

Real Numbers

Real Numbers. Real Number Storage. 4-byte IEEE Real Number format. 234.56E+02 234.56 mantissa +02 exponent. Assigning Storage for Large Numbers. Dd (define doubleword) – 4-byte storage; Real number stored as a doubleword is called a short real. Dd 12345.678 Dd +1.5E+02

cecile
Download Presentation

Real Numbers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Real Numbers

  2. Real Number Storage 4-byte IEEE Real Number format 234.56E+02 234.56 mantissa +02 exponent

  3. Assigning Storage for Large Numbers • Dd (define doubleword) – 4-byte storage; Real number stored as a doubleword is called a short real. • Dd 12345.678 • Dd +1.5E+02 • Dd 2.56E+38 ;largest positive exponent • Dd 3.3455E-39 ;largest negative exponent • Dq (Define quadword) -8-byte storage; long real number (double in C,C++ and Visual) • Dq 2.56E+307 ;largest exponent

  4. Floating Point Unit (Coprocessor) • 8 individually addressable 80-bit registers • (ST(0), ST(1), ST(2)…ST(7)) • Arranged in stack format • ST(0) = ST -> top of stack • Control Registers • 3 16-bit registers (control, status, tag) • 2 32-bit registers (instruction pointer, operand pointer)

  5. Instruction Formats • Always begin with the letter F • 2nd letter - B,I – binary coded decimal operand or binary integer operand • If 2nd letter is neither, assume real number format. • FBLD, FILD, FMUL • Can not use CPU registers as operands

  6. Floating Point Operations • Add Add source to destination • Sub Subtract source from destination • Subr Subtract destination from source • Mul Multiply source by destination • Div Divide destination by source • Divr Divide source by destination

  7. Basic Arithmetic Instructions

  8. Instructions • Classical stack • No explicit operands needed (ST, source; ST(1) destination) • FADD ;ST(1)=ST(1)+ST; pop ST(1) into ST • Register • Uses coprocessor registers as ordinary operands (one must ST)

  9. Evaluating a postfix expression • Well suited for evaluating postfix expressions. • When reading an operand from input, push it on stack • When reading an operator from input, pop the two operands located on the top of the stack, perform the selected operation on the operands, and push the result back on the stack.

  10. Register Stack Example

More Related