I'm not sure if this is a bug or a feature, but I'll throw it out there for your consideration....
In my FMD88-10 I have a Custom Function that takes an incoming analog voltage, scales it and converts the voltage to a temperature. The last step in my CF is to convert the temperature from degrees C to degrees F using the commonly known equation:
F = (C * (9/5)) +32
Great, right? WRONG! The unnecessary pair of parentheses around the "9/5" causes the TBasic to yield an incorrect answer.
At room temperature (25C), the above equation yields and answer that's 17F degrees low. At a temperature of 200C, the answer is over 150F too low.
What I know is...
- That the "()" around the "9/5" is unnecessary.
- That "F = (C * (9/5)) +32" is mathematically identical to "F = (C * 9/5) +32".
- That with or without the "()", the above equations will yield the identical answers when calculated in a spreadsheet, with a hand calculator or using simple pencil and paper.
So, the question is... why does TBasic yield an incorrect answer when unnecessary "()" are there? Shouldn't it just ignore them?