cprecision

C precision of double: compiler dependent?


on my 32-bit machine (with an Intel T7700 duo core), I have 15 precision digits for both double and long double types for the C language. I compared the parameters LDBL_DIG for long double and DBL_DIG for double and they are both 15. I got these answers using MVS2008. I was wondering if these results can be compiler dependent or do they just depend on my processor?


Solution

  • Some compilers support a long double format that has more precision than double. Microsoft MSVC isn't one of them. If 15 significant digits isn't good enough then the odds are very high that you shouldn't be using a floating point type in the first place. Check this thread for arbitrary precision libraries.