1

If I had the floating point (saved in some $f register) 1684.714 how could I round that to 1684.71? If I had the floating point 1684.716, how could I round that to 1684.72?

1 Answers1

0

Supposing you are using $f0:

addi $t0, $s0, 100    ; t0 = 100
mult $f0, $t0         ; LO = f0*100
mflo $f1              ; f1 = LO
round.w.s $f1, $f1    ; f1 = round(f1)
mfc1 $t1, $f1         ; t1 = f1
div $t1, $t0          ; LO = t1/100
mflo $t2              ; t2 = LO

$t2 has the rounded value.

Yago Tomé
  • 46
  • 4