如何在 MIPS 中舍入浮点数?
how to round a float number in MIPS?
假设我在 $f0 寄存器中有一个浮点数 15.752893 ...。
我如何将其四舍五入为最接近的整数 16?
使用下面的函数,
round.w.s $f0, $f0
mfc1 $a0, $f0 # moving the integer into $a0
li $v0, 1 # load code to print integer
syscall
假设我在 $f0 寄存器中有一个浮点数 15.752893 ...。
我如何将其四舍五入为最接近的整数 16?
使用下面的函数,
round.w.s $f0, $f0
mfc1 $a0, $f0 # moving the integer into $a0
li $v0, 1 # load code to print integer
syscall