Implement single precision floating point addition in MIPS assembly language. Pr
ID: 3622338 • Letter: I
Question
Implement single precision floating point addition in MIPS assembly language. Prompt user to input two floating point (decimal) numbers and compute and display the sum.the program should be able to handle negative numbers as well.
Examples:
Enter a floating-point value: 1
Enter a floating-point value: 1
Sum: 2.000000000000000000
Enter a floating-point value: 2.2
Enter a floating-point value: 1.4
Sum: 3.599999904632568400
Enter a floating-point value: -1.34
Enter a floating-point value: 3.4
Sum: 2.059999942779541000
Enter a floating-point value: 10.5
Enter a floating-point value: 100.2
Sum: 110.69999694824219000
Explanation / Answer
Dear user, Here is the single precision floating point addition in MIPS assembly language: ###### Data segment ############ .data Prompt1:.asciiz "Enter a floating-point value:" Prompt2:.asciiz "Enter a floating-point value:" Pro_msg: .asciiz "product:" Sum_msg: .asciiz "Sum:" Error_msg:.asciiz "Input Zero" ######## Code segment ######## .text .globl main main: la $a0,prompt1 # display prompt string li $v0,4 syscall li $v0,5 # read 1st integer into $t0 syscall move $t0,$v0 la $a0,prompt2 #display prompt string li $v0,4 syscall li $v0,5 # read 1st integer into $t0 syscall move $t1,$v0 beqz $t2,else beqz $t1,else #calculate product add $t2,$t0,$t1 la $a0,Sum _msg # display prompt string li $v0,4 syscall move $a0,$t2 # output sum li $v0,1 syscall else: la $a0,Error_msg # display prompt string li $v0,4 syscall li $v0,10 # exit syscall