double Double-precision floating-point type
double Double-precision floating-point type
double has at least float's precision and range. Unsuffixed literals are double; 64-bit IEEE 754 is common. Approximation complicates monetary calculation.
| Category | Type specifiers |
|---|---|
| Kind | Keyword / Statement |
| C standard | C89 / C90 |
📝 Syntax
double d = 3.14159265358979;
▶ Example
Edit the C code below and click Run; the server compiles and executes it:
Output:
circumference = 6.28318
🏷️ Related type specifiers
📚 Related Tutorials
❓ FAQ
QCan double represent 0.1 exactly?
ANot in common binary floating-point implementations; it stores only a nearby value. Greater precision does not make every decimal fraction exact. Financial calculations should use a suitable decimal or integer fixed-point approach.
QIs double fixed at 64 bits by the C standard?
ANo. The standard only requires precision and range at least equal to float's. Sixty-four-bit IEEE 754 double precision is common, but portable code should not treat that layout as a network or file format.
QWhat type is an unsuffixed floating-point literal?
ALiterals such as 1.25 and 1e3 have type double. An f or F suffix produces float, while l or L produces long double. The suffix determines the literal's type, not whether its decimal value is exact.