MIPS - problem with ceil.w.s instruction

Reply

Join Date: Apr 2008
Posts: 1
Reputation: payton is an unknown quantity at this point 
Solved Threads: 0
payton payton is offline Offline
Newbie Poster

MIPS - problem with ceil.w.s instruction

 
0
  #1
Apr 24th, 2008
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
  1. 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?
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 1
Reputation: fierp is an unknown quantity at this point 
Solved Threads: 0
fierp fierp is offline Offline
Newbie Poster

Re: MIPS - problem with ceil.w.s instruction

 
0
  #2
Apr 27th, 2008
ceil.w.s is ceiling and converting to a word fixed point number. You can use:
  1. 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
Last edited by fierp; Apr 27th, 2008 at 6:30 pm.
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 1
Reputation: paytonb is an unknown quantity at this point 
Solved Threads: 0
paytonb paytonb is offline Offline
Newbie Poster

Re: MIPS - problem with ceil.w.s instruction

 
0
  #3
Apr 28th, 2008
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!!!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Assembly Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC