"Phil" wrote in news:bt4jtv$ms4$ snipped-for-privacy@titan.btinternet.com:
Since it starts with two underscores, it is defined by the implementation (compiler vendor or library author). Look in the library or compiler documentation for '__E'. Developers are not supposed to name variables with leading underscores (even in assy. if you want to mix C and assy) unless you are writing a compiler. Well there are some exceptions but why risk it?
This is just a guess as my math is rusty. According to the app note, you want ln(V_ADC/(V_REF-V_ADC)
ln() is not the same as log(). I believe ln (natural log) is the log with respect to the mathematical constant e. So, I assume the extra /log(__E) is to adjust log to be a natural log. So, I believe __E is supposed to represent the math constant e. I just don't remember what the value of e is.
The original formula calls for a ln() function (natural log) and it was written using log() function (base 10). In order to convert to base 'e' you need to divide by log(e).
Somewhere 'e' must be defined. If you can't find it just define it as
Hold right there.... Since it's a C source we appear to be talking about here, that had better be false. The C standard library function log() _is_ the natural logarithm. If you want the log10(), you can get that too, but that would be pretty pointless in the circumstances.
I'm saying this under the assumption that the compiler makers at least tried to act reasonably regarding ISO C standard compliance, where it makes sense to do so. I.e. if your C compiler has a function named log() in declared in , and that computes anything else but the natural logarithm, that's IMHO sufficient grounds for immediately firing whoever bought it (and never talking to its maker again until they fix that error).
--
Hans-Bernhard Broeker (broeker@physik.rwth-aachen.de)
Even if all the snow were burnt, ashes would remain.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.