C++ long


Example

Denotes a signed integer type that is at least as long as int, and whose range includes at least -2147483647 to +2147483647, inclusive (that is, -(2^31 - 1) to +(2^31 - 1)). This type can also be written as long int.

const long approx_seconds_per_year = 60L*60L*24L*365L;

The combination long double denotes a floating point type, which has the widest range out of the three floating point types.

long double area(long double radius) {
    const long double pi = 3.1415926535897932385L;
    return pi*radius*radius;
}
C++11

When the long specifier occurs twice, as in long long, it denotes a signed integer type that is at least as long as long, and whose range includes at least -9223372036854775807 to +9223372036854775807, inclusive (that is, -(2^63 - 1) to +(2^63 - 1)).

// support files up to 2 TiB
const long long max_file_size = 2LL << 40;