我从 MIPS 开始,并被分配了一项作业,我必须在其中找到三角形的斜边(给定它的腿)(它们都是单精度浮点数)。但是,在每一步中,我都必须通过将数字与“无限”的 IEEE754 表示进行比较来检查溢出,但我不知道该怎么做,如果有任何帮助,我将不胜感激。
编辑:到目前为止我只有代码用于输入。
.text
main:
in1: li $v0,4 #
la $a0,inleg1 #message to request leg 1
syscall #
li $v0,6 #read entered value as float
syscall
mov.s $f1,$f0 #move read value --> $f1=leg1
#So now I have to include a condition to detect overflow, and show an error message and request the number again
#The idea is to compare $f1 with infinity, and if it's not smaller, we have overflow
#Then I have to repeat the evaluation after every operation performed