Another basic question I just must ask.
Any answer is much appreciated.
Another basic question I just must ask.
Any answer is much appreciated.
exp(x)
returns e (the base of natural logarithms) raised to the power of x.
exp10(x)
returns 10 raised to the power of x.
exp
: compute e (the base of natural
logarithms) raised to the power x exp10
: compute 10 raised to the power x. Mathematically, exp10(x) is the same as exp(x*log(10)), where log(x) is the logarithm to the base e (Euler number).You should first check your handy C reference manual for questions like this, rather than going online. According to mine ("C: A Reference Manual", Harbison & Steele, 5th ed.), exp10()
is not part of the standard C math library; it appears to be a GNU-specific extension.
You should be able to get the same result using the standard library function pow()
:
#include <math.h>
int x = ...;
double v = pow(10.0, x);