Log functions not included in list of math functio

The reference page does not include the log functions.

AFAIK, all functions defined in the mathematics library in AVR LibC are avaliable: avr-libc: <math.h>: Mathematics.
One thing to note is that all floating point variables, both float and double, are 32 bits.

The [u]reference page[/u] does not include the log functions.

I'm glad you posted this question - I had been looking for the log function also and could not find it in reference section. Now because of your thread, I find it in the link - just hope it works when I try to use it later tonight or this weekend.

Ken H>

you're right, it isn't in the listed functions. however, they are supported (or at least arduino compiles with them in the code).

for log base 10, the syntax is log10(input);

for natural log (ln), it's log(input);

maybe somebody should edit the listed functions in the reference section to include this; it seems like it would be used commonly.

I apologize, I apparently have no idea what I'm talking about. log(x) works, but log10(x) does nothing.

I think a workaround may be to do this: If you want to find log base 10 of X, then you can do the natural log of X over the natural log of 10. so in english, logX = lnX/ln10. in arduino, it is

 log(x) / log(10);

I'm not sure, however.


log(x) / log(10);

I'm not sure, however.

But you are right :)

I noticed that it lacks in the keywords.txt file (for arduino 0017 at least, I think also in 0018). It is only a matter of adding an entry below the "# KEYWORD2" section:

log      KEYWORD2      Log

Not a big deal though, but it's nice to have the syntax colour right.