[I'm too lazy to fix the top post today, context elided.] --- In [email protected], Jos Timanta Tarigan <jos_t_tari...@...> 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
