1

I am not sure how to print out a floating point single with one decimal place.

I get '88.09999847' instead of '88.1'. Please advise

For example: if I have register $f10 = '88.09999847'

mov.s   $f12,   $f10

li  $v0,    2   

syscall

I get output as "88.09999847"

How do I round up to one decimal place and print out "88.1"

Any help would be appreciated

4

1 回答 1

0

1)将数字乘以 10(因为您要四舍五入到小数点后一位。)
2)将数字压入堆栈(或适当的寄存器。)
3)回合是系统调用(在我的机器上,代码是call roundf
4 ) 将结果除以 10

于 2009-07-14T19:01:52.787 回答