我将我的问题浓缩为以下代码:
.data
newline: .asciiz "\n"
.text
.globl main
main:
li $t0, 4
li $t1, 16
mtc1 $t0, $f2 # Two integers get stored as floats
mtc1 $t1, $f30
div.d $f12, $f2, $f30
li $v0, 3
syscall # First division works, returns 0.25
la $a0, newline
li $v0, 4
syscall # prints new line
div.d $f12, $f12, $f30
li $v0, 3
syscall # Second division doesn't work as expected, returns Infinity
输出是:
0.25
Infinity
这是为什么?我希望0.25/16
是 ~0.015625
而不是Infinity
.
$f12 的第一个值:0x3fd0000000000000 $f12 的第二个值:0x7ff0000000000000
我对 MIPS 比较陌生,所以它可能很容易。感谢您的任何回答!