From: terra AT diku DOT dk (Morten Welinder) Newsgroups: comp.os.msdos.djgpp Subject: Re: math.h sin() function returns wrong value Date: 12 Jul 1997 23:46:43 GMT Organization: Department of Computer Science, U of Copenhagen Lines: 20 Sender: terra AT thor DOT diku DOT dk Message-ID: <5q9513$84r@vidar.diku.dk> References: <199707120536 DOT WAA15679 AT adit DOT ap DOT net> <33c7fd44 DOT 36048826 AT news DOT btinternet DOT com> NNTP-Posting-Host: thor.diku.dk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk T DOT Harte AT btinternet DOT com (Thomas Harte) writes: >#define degtorad(x) (double)x / 180 * PI >#define radtodeg(x) (double)x / PI * 180 > . . . although I probably need some brackets, not that I can see where, >I'm just guessing. You need them! Suppose you were to write "degtorad (v + 10)" in your program. The compiler would then see "(double)v + 10 / 180 * PI" which is not quite what you wanted. Either use an inline function or something like #define degtorad(x) ((x) / 180.0 * PI) Morale, if any: always use parenthesis around macro parameters, unless you are trying to do something you couldn't do with a function. Morten