0
$\begingroup$

I just came across this in my work and find it rather baffling:

The format and arithmetic of floating point numbers is described by several standards. For instance, IEEE 754 is a widely used standard for the case b=2. It considers, amongst other things,  single-precision numbers: - 32 bits: 1 bit sign, 8 bits exponent, 23 bits mantissa, bias 127 - range: approx. ± 3.403 × 10^38 - numbers closest to 0: approx. ± 1.175 × 10^-38  double-precision numbers:  - 64 bits: 1 bit sign, 11 bits exponent, 52 bits mantissa, bias 1023  - range: approx. ± 1.798 × 10^308  - numbers closest to 0: approx. ± 2.225 × 10^-308 

I'm not too sure how to interpret all of this so I'll start with a basic question...

What is the main functional difference between single and double precision numbers?

Looking earlier on in my notes I found the following:

The representation of real numbers in computers is based on the following principle:  Any r ∈ ℝ can be approximated by a floating point number r ≈ s × m × b^e,  where  Example: 12.25 = 1 × 0.0001225 × 10^5 [ = 1 × 122.5 × 10^-1] - s ∈ {1,-1} is the sign, - m ∈ ℝ is the mantissa, - b ∈ ℕ is the base and - e ∈ ℤ is the exponent. 

Is there any relation between the two concepts?

  • 0
    double-precision numbers use more bits, so have more significant digits. This question probably belongs on [stackoverflow](http://www.stackoverflow.com), by the way.2012-04-20

1 Answers 1

2

Yes, the concepts are related. The older section is general, independent of base or number of bits used. However, where you have be you should have b^e or $b^e$. Similarly in the example 105 should be 10^5 and 10-1 should be 10^(-1). Note that it is an approximation-only a subset of the reals can be represented exactly.

The IEEE spec is a particular example. Double precision takes twice the memory and may take longer to operate on, depending on the computer. For single precision, the 23 bits allocated to the mantissa says there are $2^{23} \approx 8$ million values. The 8 bit exponent can range from 0 to 255, but the bias (as in your earlier question) says we consider this to be -127 to 128. The range is the largest and smallest number we can represent, roughly $\pm 2^{128}$ but the gap between two representable numbers is set by the mantissa. Neighboring ones will differ by about one part in $2^{23}$ Double precision has both a larger range and finer granularity. The spec is an attempt to share the available bits to get us the most useful set of numbers available.

  • 0
    I've made the updates to the question thanks for the fantastic answer! It makes perfect sense now!2012-04-20