I'm having some snags trying to perform some conditional compilation based on the magnitude of a literal: TecDrive = (int)( #if ((P_GAIN < 1) && (P_GAIN > 0)) (TemperatureError / (int)(1/P_GAIN))+ #else (TemperatureError * P_GAIN )+ #endif #if ((I_GAIN < 1) && (I_GAIN > 0)) (TemperatureIntegral / (int)(1/I_GAIN)); #else (TemperatureIntegral * I_GAIN)); #endif This is part of a PI (no D) control loop. I want to be able to specify the various gains as literals in an include file, and I wish to be able to use gains below 1 e.g. 0.5. However I am using integer math, and I am basicaly trying to make the compiler replace the multiply with a divide by 1/GAIN is the gain is less than 1 but greater than 0. This scheme works for integer values of 1 or greater, but whenever I try to use a fractional value I get the error "Illegal #if line (error)". After some experiementation is seems that any floating point value within a #if line throws this error e.g. #if (1.0 < 2.0) will throw the same error. Has anyone seen this and is it an inherent limitation of the pre-processor, or am I (most likely) doing something stupid? Regards Mike -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu