`double` — C Keyword

`double` — C Keyword

The double keyword in C: a double-precision IEEE 754 floating-point type.

How to use this reference page

Use reference pages to confirm names, categories, nearby facilities, and the constraints that matter before writing or reviewing code.

  • Scan the top of the page first to identify the primary types, functions, or algorithm families involved.
  • Use the nearby-page links when your question is really about a companion header, related algorithm family, or broader subsystem.
  • Validate tricky behavior with a small compileable example before relying on memory for details like invalidation, ordering, allocation, or lifetime rules.

double (C)

A double-precision floating-point type (IEEE 754 binary64, 64 bits), providing approximately 15–16 significant decimal digits.

Syntax

double d;
double d = 3.14159265358979;
long double ld;   /* extended precision; at least as wide as double */

Example

#include <stdio.h>
#include <math.h>

int main(void) {
    double pi = 3.14159265358979;
    double r  = 5.0;

    printf("%.10f\n", pi * r * r);  /* 78.5398163397 */
    printf("%.15f\n", sqrt(2.0));   /* 1.414213562373095 */
    return 0;
}

Notes

Example in practice

int 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;
}