4
$\begingroup$

I read that the further you get from 0, the less precision, due the way they are stored.

So why aren't numbers stored like this: $32$ bits for representing a value between $-2^{31}$ and $2^{31}-1$ before the decimal point and another $32$ bits for representing the precision. $\frac{1}{2^{32}} = 0,00000000023$, which would be a fairly precise interval.

With this type of storage there would be no precision loss at high values.

$\endgroup$
  • 1
    $\begingroup$ You mean real numbers. Not floating point numbers. Floating point is the name for the representation. The representation you're presenting is not floating point. Also, with your representation you wouldn't be able to represent as high values as with floating point with the same amount of bits. $\endgroup$ – Auberon Sep 14 '16 at 13:50
  • $\begingroup$ You can trade range vs (homogeneity of) precision. $\endgroup$ – Raphael Sep 14 '16 at 16:21
  • 1
    $\begingroup$ Your argument seems to be like this. "If somebody tells me that an inch is 25mm, that's OK because it's wrong by at most 0.5mm. But if they tell me that they have \$25,000,000, that's terrible, because they could be wrong by up to \$500,000!" But the relative error is the same in both cases. $\endgroup$ – David Richerby Sep 15 '16 at 7:28
6
$\begingroup$

In a floating point, by definition, the point floats. What you're proposing is fixed point (which is occasionally used in practice).

A normal IEEE 754 64-bit double precision can store values in the range from $-10^{308}$ to $10^{308}$. This is a much larger range than your system can store given 64 bits (you would need nearly 800 bits to achieve the same).

The precision loss is often acceptable. When you are dealing with a very large value (like $10^{308}$) what comes at the $10^{\textrm{th}}$ place after the decimal point has no significant impact on the outcome of your calculation. When you are dealing with a very small value (like $10^{-20}$), what comes at the $10^{\textrm{th}}$ place after the decimal point has a huge impact on your calculation.

Using floating point thus makes a lot of sense: you get a level of precision that is appropriate for the range of values you're dealing with, and it can represent a very wide range of values in limited space.

$\endgroup$
3
$\begingroup$

The gravitational constant is about $6.67 \times 10^{-11} N m^2 kg^{-2}$.

You would want a scheme that allows storing this number at the full known precision. Unfortunately, it is about 1 quarter of the smallest non-zero number that your scheme can represent.

Avogadro's constant is about $6 \times 10^{23} mol^{-1}$.

The opposite problem; this is more than $10^{14}$ times larger than the largest number in your scheme.

IEEE 754 format floating point numbers can approximate numbers in a huge range. You have been misled by the notion that precision is lower as you go further away from zero. But relative precision stays the same.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.