dh_007 0 Newbie Poster

my code gives me a 0.0000000 for the result when I try and use the sra $s3, $s1, 1
to divide the number in 2

#this works div $s2, $s1, 1 <when I use this it prints out the number entered.

I also have tried putting the numbers in f registers and trying to divide from there. Got the same result 0.00000000

.data # Begin data segment
Tolerence_Msg: .asciiz "Enter tolerence "
Real_Msg: .asciiz "\n\nEnter Real Number: "


.text # Begin code segment
.globl main # first instr must be global

main:

# header message
li $v0, 4 # print string code
la $a0, Tolerence_Msg # pointer to string
syscall

li $v0, 6 # read float code
syscall
mfc1 $s0,$f0 # move operand tolerence from $f0 to $s0


# Print tolerence results
li $v0, 2
mtc1 $s0,$f12 # put tolerence in $f12 for printing
syscall

li $v0, 4 # print string code
la $a0, Real_Msg # pointer to string
syscall

li $v0, 6 # read float code
syscall
mfc1 $s1,$f0 # move operand real from $f0 to $s1


# Print real results
li $v0, 2
mtc1 $s1,$f12 # put real in $f12 for printing
syscall # prints real number entered

li $v0, 4 # print string code
la $a0, Tolerence_Msg # pointer to string
syscall

#addi $s2, $s2,2

#mtc1 $s2,$f2 # f2 = 2
#mtc1 $s1, $f6 # f6 = Real
#div.s $f4, $f6, $f2 # s3 = square_rt
#this works div $s2, $s1, 1
sra $s3, $s1, 1
li $v0,2
mtc1 $s3, $f12 # put A in $f12 for printing
syscall
li $v0,10
syscall