-8

What's the difference between a single precision and double precision floating values?

codemax12
  • 29
  • 3

2 Answers2

3

In C, double has at least as much precision as, and usually more than, float, and has at least the exponent range of, and usually more than, float.

The C standard only requires that double be able to represent all the values of float: “The set of values of the type float is a subset of the set of values of the type double…” (C 3028 6.2.5 10).

In typical common implementations today, float is represented with 32 bits in the IEEE-754 binary32 format, and double is represented with 64 bits in the binary64 format.

Eric Postpischil
  • 195,579
  • 13
  • 168
  • 312
0

Single precision (float) is stored in 4 bytes (32bits). Double precision (double) is stored in 8 bytes (64bits).

Kedriik
  • 331
  • 4
  • 12