What is the range of long double in C++?
Asked
Active
Viewed 3.0k times
4 Answers
14
std::numeric_limits<long double>::min()
//...
std::numeric_limits<long double>::max()
The definition of long double
is compiler & platform dependent, it is at least the same as a double
, thus, it may take 8, 12 (usually also for 80bits) or even 16 bytes (float128/quadruple precision) and has a range according to its size.

Sam
- 7,778
- 1
- 23
- 49
4
It is system (and processor, and compiler, and ABI) dependent. Look into <limits.h>
and <math.h>
and <float.h>
standard headers.

Basile Starynkevitch
- 223,805
- 18
- 296
- 547
-
1it's even compiler-dependent. – Alvin Wong Mar 10 '13 at 09:30
2
According to MSDN - Data Type Ranges (C++) and the www.cplusplus.com, the long double is the same as double, takes 8 bytes of space and lies in the range [-1.7E+308, 1.7E+308].
There are also other sites, like this, which says that long double takes 12 - 16 bytes.

Thomas Wilde
- 801
- 7
- 15

Shimon Rachlenko
- 5,469
- 40
- 51