如何解决无法确定为什么浮点比较给出语法错误
代码旨在循环,根据用户输入(n)计算斐波纳契数列。 在PCSpim即时通讯接收中:
文件第71行的(解析器)语法错误。 c.ep.d $ f0,$ f8
s.d $f2,0.0 #f0 - These two house the fibonacci f0 + f1 numbers throughout the loop
s.d $f4,1.1 #f1
li.d $f8,0.0 #Used respectively for when I need a zero or a one.
li.d $f10,1.0
mtc1 $a0,$f0 #n is entered by the user in main,converted from integer to double here.
cvt.d.w $f0,$f0 # f0 = n
sub.d $f0,$f0,$f4 # -1 from n preemptively as I do the first calculation above.
loop:
add.d $f6,$f4,$f2 #$f6 = f0 + f1
add.d $f2,$f8 # f0 = f1
add.d $f4,$f6,$f8 # f1 = (f0 + f1)
sub.d $f0,$f10 # - 1 from n
c.ep.d $f0,$f8 #comparing DoubleZero and n <--- This is where the error is coming from
bc1f loop #continue to loop if n is not equal to 0.
li $v0,3
add.d $f12,$f10,$f6 #print the double
syscall
#move $v0,$f4
jr $ra #return to main```
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。