I needed a link and figured I'd post this for other users who might need a link to where the math docs are. For some reason the admin has decided this information should not even be in extended reference.

Arduino trig and exponential functions use the avr-libc library. The library includes a great number of useful mathematical functions for manipulating floating point numbers.

The Atmega8 chip, which is now dated, but still supported, does not have enough memory to be able to use the math.h library so you will probably need to update to an Atmega168 if you wish to use any of these functions.

The full docs for math.h may be found

List of more common functions with descriptions

This is just a partial list - check the docs for more obscure functions

double cos (double x) // returns cosine of x in radians double fabs (double __x) // absolute value of a float double fmod (double __x, double __y) // floating point modulo double modf (double __value, double *iptr) // breaks the argument value into // integral and fractional parts double sin (double __x) // returns sine of x in radians double sqrt (double __x) // returns square root of x in radians double tan (double __x) // returns tangent of x in radians double exp (double __x) // function returns the exponential value of x. double atan (double __x) // arc tangent of x double atan2 (double __y, // arc tangent of y/x double log (double __x) // natural logarithm of x double log10 (double __x) // logarithm of x to base 10. double pow (double __x, double __y) // x to power of y double square (double __x) // square of x

See also

  • float
  • double

I suspect the intention was not to reproduce the avr-libc docs which are, as you point out, identical. I recall that there is link back to avr-libc in the appropriate places for those library details that are unchanged with respect to the Arduino and avr-libc.


I downloaded the file Math.h from "nongnu" and upload here:

is there any one did it work, normally in every Lab in libraries have 3 file 1. H file 2. TXT file 3. CPP file

so here is the H file but did any one wrote the TXT and CPP files for this Lab? and used them? if yes, could you inform us. 8-)



Can someone upload math library with all 3 files, because the link above don't work.

Thank you very much

regards :)