well in my case its a huge problem especially in the boundary. im doing a 2D world animation and in my case 0.0000001 is not moving and 0 is moving so its really significant :D i think i decided to trick this by using a small value as comparison eg if x < 0.001 then move ;)
thanks guys :) ================================= http://www.svnstrk.blogspot.com ================================= --- On Tue, 5/26/09, diya dixit <[email protected]> wrote: From: diya dixit <[email protected]> Subject: Re: [c-prog] Re: limiting precision on float To: [email protected] Date: Tuesday, May 26, 2009, 8:10 AM i think so if i m not getting u wrong it can be done by using %.3f in place of %f On 5/26/09, peternilsson42 <peternilsson42@ yahoo.com> wrote: > > > > [I'm too lazy to fix the top post today, context elided.] > > --- In c-p...@yahoogroups. com <c-prog%40yahoogrou ps.com>, Jos Timanta > Tarigan <jos_t_tarigan@ ...> wrote: > > > > 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. > > Maybe look at 'fixed point' if that's the case. [Note > that multiplying by 1024 (or some power of two) and then > dividing is probably better than using 1000.] > > But why bother? If you recognise that -cos(x+pi/2) == sin(x), > then the problem goes away for the case you mentioned. You > should be reducing your number of computations, not > increasing them. > > In any case, what is the impact of directionZ being > 1.000001 (or 0.999999, or whatever,) instead of exactly 1? > > -- > Peter > > > -- shruti dixit [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]
