i wrote this code in c++. i expect 4932.08 for the answer(calculated by calculator)
#include <iostream>
#include <float.h>
#include <math.h>
using namespace std;
int main()
{
long double a;
a = LDBL_MAX;
cout << "log10(" << a << ") = " << log10(a);
}
sizeof(a) = 16 Bytes on my computer
instead of getting the correct answer, the output was inf. what is the problem? is it about the sizeof data log10 can get? what should i do to get correct answer?
I run this code with DEV and g++ (MinGW) by CMD. results are interesting.
DEV: inf
MinGW: 4932.08
sizeof(a):
dev: 16
MinGW: 12
why???
thank you