Question about machine epsilon
Mostrar comentarios más antiguos
Hello! So I tried understanding machine epsilon, and I've properly understood that it's the smallest distance between the number 1 and the next, larger floating-point number. That said, I tried a few things_
1 + eps > 1 % Returns true
1 + eps/2 > 1 % Returns false
This is all logical to me, however, this I do not get:
1 + eps/1.5 > 1 % Returns true
This suggests that 1 + eps/1.5 (which is smaller than 1 + eps) can be stored as a number without being rounded to 1, which contradicts the definition of epsilon. So naturally, I thought that eps/1.5 was rounded somehow, before being added to 1, but the only explanation that can justify it is if eps/1.5 is somehow rounded to eps. However, since both 1 + eps/1.99 > 1 and 1 + eps/1.01 > 1, I just don't see how that makes any sense. It seems that 1 + eps/2 is the smallest number N which yields that 1 + N = 1. Why not a larger number? I know that I'm missing something, and I think it's related to the computer using binary to compute.
Thanks in advance!
Respuesta aceptada
Más respuestas (1)
Walter Roberson
el 28 de Nov. de 2016
(1 + eps/1.5) - (1 + eps)
gives 0. So 1 + eps/1.5 is being rounded to 1 + eps.
Computations are carried out with at least 1 guard bit and then rounded.
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!