I\'m using some macros, and observing some strange behaviour.
I\'ve defined PI as a constant, and then used it in macros to convert degrees to radians and radians to
Macros are (relatively simple) textual substitutions.
Use parentheses in your definitions (both to enclose the macro itself and the macro arguments):
#define PI (atan(1) * 4) #define radians(deg) ((deg) * PI / 180) #define degrees(rad) ((rad) * 180 / PI)