`double` — C++ Keyword
`double` — C++ Keyword
The double keyword in C++: a double-precision IEEE 754 floating-point type.
`double` — C++ Keyword
The double keyword in C++: a double-precision IEEE 754 floating-point type.
Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.
doubleA double-precision floating-point type. On all modern platforms this is a 64-bit IEEE 754 binary64 value, providing approximately 15–16 significant decimal digits.
double d;
double d = 3.14159265358979;
long double ld; // at least as wide as double; often 80-bit extended on x86
#include <print>
#include <cmath>
#include <cfloat>
#include <numbers>
int main() {
double pi = std::numbers::pi;
double r = 5.0;
std::println("{:.10f}", pi * r * r); // 78.5398163397
std::println("DBL_MAX: {:.2e}", DBL_MAX); // ~1.80e+308
std::println("DBL_EPSILON: {}", DBL_EPSILON); // 2.22...e-16
// std::sqrt returns double
std::println("{}", std::sqrt(2.0)); // 1.41421356...
}
double by default.long double; for GPU/SIMD performance, use float.==; compare with an epsilon tolerance instead.doubleint main() {
// Pick one facility from this reference page.
// Write the smallest program that exercises its main precondition,
// complexity rule, or lifetime constraint before scaling up.
return 0;
}