floating point - Assembly storing float to memory -
i'm working on mini-compiler. want store float number memory, want store in following way:
first, want reserve space 2 variables.
then, want put number 2 in first 1 (this give me information later stored float in location), , want put actual float number in second one.
i want reserve space integer too, first variable (the flag) 4 integer in code.
i seem error in cases (not cases). says i'm accessing unreadable place on memory. here's code :
ori $a2,$0,2 ori $v0,$0,9 syscall addi $sp,$sp,-8 sw $v0,0($sp) ori $t2,$0,1 sw $t2,4($v0) ori $t2,$0,4 sw $t2,0($v0) ori $a2,$0,2 ori $v0,$0,9 syscall addi $sp,$sp,-8 sw $v0,0($sp) li.s $f2,1.2 s.s $f2,4($v0) ori $t2,$0,2 sw $t2,0($v0)
in code i'm first saving integer (1) flag 4.
then, i'm saving float (1.2) flag 2.
this case gives exception, in other cases doesn't give exception, float number rounded. if 2.5, it's stored 2.5000002.
can 1 me that?
Comments
Post a Comment