Message-ID: <384C84B6.A0E3D7CD@cal2.vsnl.net.in> Date: Mon, 06 Dec 1999 17:53:26 -1000 From: "Dr. Keya Chaudhuri" X-Mailer: Mozilla 4.01 [en] (Win95; I) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Re: Help needed with a program I am writing X-Priority: 3 (Normal) References: <82f61g$54c$1 AT nntp8 DOT atl DOT mindspring DOT net> <384B316E DOT 91AE9766 AT snetch DOT cpg DOT com DOT au> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Michael Abbott aka frEk wrote: > > Heya > > Marp wrote: > > > P K wrote in message > > news:dPE24.416$wM4 DOT 28044 AT news-west DOT eli DOT net... > > > > > > > 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