- 4,650
- 39
Is there a predefined function in C++ that will allow me to take LOG(base 10) of a number? If not, is there a reasonably simple work-around?
thanks,
MIH
thanks,
MIH
sweet! thanks, gerben.gerben said:yes there is
pow() apparently returns a double, but you can change the type of the returned variable by type-casting it to an int like this:
num = num % static_cast<int>( pow(10, expo) );
Hurkyl said:Certainly. It's log. It's declared in the cmath header. (math.h if you're using C-style headers)
Math Is Hard said:ah well...who knows, franz. maybe you'll need that info one day.