Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Machine epsilon, ε: What is step to next smaller value from 1?

We know that machine epsilon, ε, is ”the difference between 1 and the least value greater than 1 that is representable in the given floating point type”.1

However, the definition says nothing about the next smaller value. What is the difference between 1 and the next smaller value?


Note

1 ISO/IEC C 2011 standard, section 5.2.4.2.2, paragraph 13 (not authoritative on floating point but one example of the common description of machine epsilon).

like image 262
Sean Avatar asked Sep 20 '13 05:09

Sean


1 Answers

No.

1-ε/2 is the largest number below 1. 1+ε is the smallest number above 1.

The significand for a normalized floating-point number is always in the range [1,2). Therefore, to represent numbers in the range [0.5,1), the exponent is -1 and the LSB is half as large.

So in binary, 1 + ε is something like:

1 + ε = 1.000...0001 ⨯ 20

You can see that there's no number between 1 and 1 + ε, which matches the definition for ε.

But 1 - ε is something like:

1 - ε = 1.111...1110 ⨯ 2-1

So there is exactly one number between 1 - ε and 1, that is, 1 - ε/2.

like image 125
Dietrich Epp Avatar answered Jan 01 '23 11:01

Dietrich Epp