hi
sorry I mean angleX + 90 = 90 which means angleX = 0
my PI_RADIAN is 0.0174532925199432958 ( I copied it from a site :D )
so i googled around and seemed that I can only do this two ways1. deal with 
string and use setPrecision and then convert back to double2. muliply, int, and 
divide to float eg. want to get 3 decimal, multiply by 1000, convert to int, 
and then divide with 1000 to float.
which one dyou think is faster? Im gonna do this calculation a lot like 300 
times / second :D 


================================= 
http://www.svnstrk.blogspot.com  
=================================

--- On Sun, 5/24/09, peternilsson42 <[email protected]> wrote:

From: peternilsson42 <[email protected]>
Subject: [c-prog] Re: limiting precision on float
To: [email protected]
Date: Sunday, May 24, 2009, 11:06 PM











 






    
            
            


      
      --- In c-p...@yahoogroups. com, Jos Timanta Tarigan <jos_t_tarigan@ ...> 
wrote:

>

> hi,

> im currently having a problem try to calculate this:

> directionZ = -cos((angleX+ 90)*PI_RADIAN) ;



What is PI_RADIAN? [I'll assume (PI/180).]



You could try...



directionZ = -cos((angleX+ 90)/180.* PI);



Or more simply...



directionZ = sin(angleX/180. *PI);



Better still would be to work in radians entirely, though

that won't remove all the issues.



> most of the time it works but when im in the boundary

> of the coordinate, it gives me a little error that im

> not expecting if calculated correctly. i notice that

> when my angleX is 90, and my directionZ should be 0.



Really? The cosine of 180 degrees is -1 on my planet. ;)



-- 

Peter




 

      

    
    
        
         
        
        


        


        
        
        
        
        




      

[Non-text portions of this message have been removed]

Reply via email to