Lecture 06 - MIPS Floating Point Arithmetic
Lecture 06 - MIPS Floating Point Arithmetic
Lecture 06 - MIPS Floating Point Arithmetic
Embedded Systems
SPRING 2023
S Exponent Fraction
10111110001000000000000000000000
Solution:
Sign = 1 is negative
Exponent = (01111100)2 = 124, E – bias = 124 – 127 = –3
Significand = (1.0100 … 0)2 = 1 + 2-2 = 1.25 (1. is implicit)
Value in decimal = –1.25 × 2–3 = –0.15625
What is the decimal value of?
01000001001001100000000000000000
Solution: implicit
Value in decimal = +(1.01001100 … 0)2 × 2130–127
= (1.01001100 … 0)2 × 23 = (1010.01100 … 0)2 = 10.375
8 Embedded Systems Dr. Tarek Abdul Hamid
Examples of Double Precision Float
What is the decimal value of this Double Precision float ?
01000000010100101010000000000000
00000000000000000000000000000000
Solution:
Value of exponent = (10000000101)2 – Bias = 1029 – 1023 = 6
Value of double float = (1.00101010 … 0)2 × 26 (1. is implicit)
= (1001010.10 … 0)2
= 74.5
What is the decimal value of ?
10111111100010000000000000000000
00000000000000000000000000000000
.DOUBLE Directive
Stores the listed values as double-precision floating point
Examples
var1: .FLOAT 12.3, -0.1
var2: .DOUBLE 1.5e-10
pi: .DOUBLE 3.1415926535897924
F = 8x2 + 9x + 15
“Assume that the variables x and F are assigned to registers $f0 and $f2 respectively”
add.s $f2,$f11,$f13 # F = 8x + 9
mul.s $f2,$f2,$f0 # F = (8x+9) x = 8x2 + 9x