anyway, is there a way to make my program only works on eg. 3 decimal 
precision? so in result, everytime I do a floating point precision, it always 
truncated after 3 decimal.
thx in advance :)

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

--- On Mon, 5/25/09, Jos Timanta Tarigan <[email protected]> wrote:

From: Jos Timanta Tarigan <[email protected]>
Subject: Re: [c-prog] Re: limiting precision on float
To: [email protected]
Date: Monday, May 25, 2009, 2:17 AM











 






    
            
            


      
      hi

sorry I mean angleX + 90 = 90 which means angleX = 0

my PI_RADIAN is 0.01745329251994329 58 ( 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 <peternilsson42@ yahoo.com> wrote:



From: peternilsson42 <peternilsson42@ yahoo.com>

Subject: [c-prog] Re: limiting precision on float

To: c-p...@yahoogroups. com

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]




 

      

    
    
        
         
        
        


        


        
        
        
        
        




      

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

Reply via email to