MIPS Input floating point number

后端 未结 3 1358
有刺的猬
有刺的猬 2021-01-16 00:29

How do you take in an input of a floating number in MIPS? I have tried using:

li.s $f0, 6 
syscall

But I just keep getting that there is a

3条回答
  •  离开以前
    2021-01-16 00:45

    you cannot load-immediate a number into float registers

    li $t0, 6           # load-immediate 6 into an int register
    mtc1 $t0, $f0       # copies the bit pattern "...110". It is NOT 6.0!!
    cvt.s.w. $f12, $f0  # convert word to (single) float. $f12 now contains 6.0
    

提交回复
热议问题