Mail Archives: djgpp/1999/12/06/10:15:21
Michael Abbott aka frEk wrote:
>
> Heya
>
> Marp wrote:
>
> > P K <paulkennedy AT citlink DOT net> wrote in message
> > news:dPE24.416$wM4 DOT 28044 AT news-west DOT eli DOT net...
> > <snip>
> >
> > > cos_table[a]=cos((float)a/180 * pi);
> > > sin_table[a]=sin((float)a/180 * pi);
> >
> > I'm not sure why you get the error you do, but you want the a/180 to be
> > calculated first, right? You have to surround that with parenthesis
> > otherwise the 180 * pi gets calculated first (order of operations) and you
> > get a different number from the one you want.
>
> I'm not sure about that one... Isn't * on the same level as / which means that
> anything on that level gets calculated from left to right? Correct me if I'm
> wrong :)
>
> - Michael
I think you are right about this one.* and / ARE on the same level of
precedence which means the expression is evaluated from left to right.
Anyway,to solve the problem, if I am not wrong ,sin and cos return a
double,so you could try casting the result as a float and see.
Kamalika
- Raw text -