0

Assume representation of floating point in decimal, in the form $0.q_1q_2...q_n\cdot 10^{exp}$. By definition $1+\epsilon_{\text{mach}} = 1$, but a textbook claims that with this definition, $\epsilon_{mach} = 10^{-n}$.

The question I have is, suppose I do $0+\epsilon_{\text{mach}} = 0.00....01 \cdot 10^0 \ne 0$. It is representable in floating point as non-zero number. Doesn't this contradict the definition of $\epsilon_{\text{mach}}$?

And if we were to say $\epsilon_{mach} = 10^{-(n+1)}$, then wouldn't another number, say $2\cdot 10^{-(n+1)} > \epsilon_{mach}$ also be ignored?

nabu1227
  • 879
  • If you add $1$ and $0.x_1x_2...x_n$, your normalization would demand that the result be represented as $0.1x_1x_2...x_{n-1}·10^1$? Is there in the definition of the machine number a remark that it has to be a negative power of the basis? And if not, is the rounding mode mentioned? – Lutz Lehmann Jan 29 '21 at 19:44

1 Answers1

-1

What you are missing is that floating-point addition isn't quite the same as (theoretical) real addition. A floating-point number has only finitely-many digits in its mantissa. When you add two floating-point numbers of different exponents, the mantissa of the smaller has to be shifted rightward, to align the radix points correctly - e.g if you add 1 to 1e-5, you are actually adding 1.0000... and 0.00001000... together. If you have to shift rightward more than the number of digits of the mantissa, when their sum is (truncated or rounded, depending) to the mantissa length, the extra digits past the end get dropped, so in effect the sum doesn't change the larger number.

This means the machine epsilon is the value 1 multiplied by the smallest (in magnitude) negative power of ten such that this dropping occurs.

PMar
  • 1