Question: The following MIPS program prints out the following floating point numbers in IEEE single precision format. NaN, +infinity, the largest, smallest positive, smallest positive denormal.

The following MIPS program prints out the following floating point numbers in IEEE single precision format.

NaN, +infinity, the largest, smallest positive, smallest positive denormal.

############################

.data

ZERO: .float 0

ONE: .float 1

# Numbers in IEEEE double precision format have 64 bits (two words).

LARGEST: .word 0x7f7fffff # largest positive float, 3.4028235E38

POSITIVE_MIN: .word 0x00800000 # smallest positive float, 1.17549435E-38

POSITIVE_DENOR_MIN: .word 0x00000001 # smallest positive denormal float, +1.4E-45

NL: .asciiz " "

.text

l.s $f0, ZERO

l.s $f2, ONE

div.s $f12, $f0, $f0 # f12 = 0/0 = NaN

jal printFloat

div.s $f12, $f2, $f0 # f12 = 2/0 = +infinity

jal printFloat

l.s $f12, LARGEST

jal printFloat

l.s $f12, POSITIVE_MIN

jal printFloat

l.s $f12, POSITIVE_DENOR_MIN

jal printFloat

j exit

printFloat:

li $v0, 2

syscall

la $a0, NL

li $v0, 4

syscall

jr $ra

exit: ############################

Rewrite the MIPS program to print out the same set of numbers, but using IEEEE double precision format.

Also, add an equivalent C code per instruction as the comment.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!