I am having trouble using the ceiling instruction.
I am new to assembly and have never used the
ceiling instruction before.

My values before the instruction are
$f10 = 1.1000005
$f12 = 1.0000000

the instruction I use is

ceil.w.s $f12,$f10

the value that ends up in $f12 is 2.80260e-045
which obviously returns 0.0000000 when I use
the li $v0, 2 syscall ..
what am I doing wrong?

ceil.w.s is ceiling and converting to a word fixed point number. You can use:

cvt.s.w, $f12, $f12

after the ceil to convert it back to a single.
The same will go with floor.w.s, etc.

/David

Thanks David.. I should have reposted that I had figured it out. The problem was as you said, I was not changing it to integer format before printing it. I used the ceil.w.s command then simply used mfc1.w.s to move it to a $t register and print it out. Thanks for the response!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.