double-double precision (64bit) floating point type

"Double" is a double precision (64bit) floating point type. Double precision simply means 64bit. Floating point is a form of software representation of a decimal, and in the IEEE 754 format, it consists of a sign part, a mantissa part, and an exponent part. Think of the mantissa as the number of significant digits.

# Double precision (64bit) floating point type
double

The maximum value of a floating point number that can be represented by a double precision (64bit) floating point type is defined by DBL_MAX, and the minimum value is defined by FLT_MIN.

Double sample code

This is a sample code using double.

#include <stdio.h>
#include <stdint.h>

int main (void) {
  double num = 5.4;
  
  printf("%f\n", num);
}

"%F" is used in the format specifier of printf function.

Output result.

5.400000

32-bit wide integers can be represented by doubles

Double is a floating point type, but since an integer is a floating point value, it can also represent an integer.

Keep in mind that the number is a 32-bit wide integer ( int32_t, uint32_t) means that it can be represented by a double. On the other hand, an integer with a width of 64it ( int64_t, uint64_t) is a double. I can't express it.

Associated Information