Finding Epsilon & Smallest Floating Point - Python

Click For Summary

Discussion Overview

The discussion revolves around finding the machine epsilon and the smallest floating point number in Python, specifically in the context of the IEEE 754 standard. Participants explore definitions, values, and the differences between these two concepts, as well as their implications in programming.

Discussion Character

  • Technical explanation
  • Homework-related
  • Debate/contested

Main Points Raised

  • Some participants reference Wikipedia's claim that the machine epsilon for 64-bit IEEE 754 is approximately 2.22e-16, questioning if this is the exact value in Python.
  • One participant states that in Python v3.4.2, the value of epsilon is 2.220446049250313e-16, and the smallest floating point number is 2.2250738585072014e-308, as found in the sys module.
  • There is a distinction made between machine epsilon and the smallest floating point number, with some participants noting that epsilon is the difference between 1 and the least representable float greater than 1, while the smallest positive normalized float is referred to as min.
  • One participant expresses confusion about finding a minimum floating point number such that adding it to 1 does not return 1, leading to a discussion about the relationship between min and machine epsilon.
  • Another participant points out that the smallest positive number that can be added to 1 and still yield 1 is indeed machine epsilon, which is significantly larger than min.
  • There is a meta-discussion regarding the appropriateness of homework-related questions in the forum, with some participants suggesting that such questions should be posted in a designated section.

Areas of Agreement / Disagreement

Participants generally agree on the definitions of machine epsilon and the smallest floating point number, but there is some confusion and debate regarding their implications and the expected behavior when performing arithmetic operations with these values. The discussion also highlights differing opinions on the appropriateness of homework questions in the forum.

Contextual Notes

Some participants express uncertainty about the expected behavior of floating point arithmetic, particularly regarding the addition of the smallest floating point number and its relation to machine epsilon. There are also references to specific Python versions, which may affect the values discussed.

Who May Find This Useful

This discussion may be useful for programmers, students, and anyone interested in understanding floating point representation and arithmetic in Python, particularly in the context of numerical computing and IEEE standards.

BubblesAreUs
Messages
43
Reaction score
1
I'm finding it difficult to find the exact value of epsilon on python? Moreover, I am also supposed to find the smallest floating point number as well.

Wikipedia tells me that the machine epsilon is 2−52 ≈ 2.22e-16 for 64-bit
IEEE 754 - 2008? Is this the exact value on Python?

Outside of that, I'm not sure where to start.
 
Technology news on Phys.org
BubblesAreUs said:
I'm finding it difficult to find the exact value of epsilon on python? Moreover, I am also supposed to find the smallest floating point number as well.

Wikipedia tells me that the machine epsilon is 2−52 ≈ 2.22e-16 for 64-bit
IEEE 754 - 2008? Is this the exact value on Python?

Outside of that, I'm not sure where to start.
Programmers have written routines to test for the machine epsilon using various programming languages. You could probably do a Google search and find either a routine or a description of one to use in Python.
 
BubblesAreUs said:
I'm finding it difficult to find the exact value of epsilon on python? Moreover, I am also supposed to find the smallest floating point number as well.

Wikipedia tells me that the machine epsilon is 2−52 ≈ 2.22e-16 for 64-bit
IEEE 754 - 2008? Is this the exact value on Python?

Outside of that, I'm not sure where to start.
In Python v3.4.2, epsilon is 2.220446049250313e-16. The float_info member of the sys module contains this information.
 
Mark44 said:
In Python v3.4.2, epsilon is 2.220446049250313e-16. The float_info member of the sys module contains this information.
I just tried out sys. and got the following:

>>> sys.float_info.epsilon
2.220446049250313e-16
>>> sys.float_info.min
2.2250738585072014e-308

I am looking for the smallest floating point number. Oddly, I was expecting the smallest floating point number to be greater than machin epsilon.

PS: Will try that out as well SteamKing.
 
BubblesAreUs said:
I am looking for the smallest floating point number. Oddly, I was expecting the smallest floating point number to be greater than machin epsilon.
Machine epsilon and the smallest floating point number are different things.
From the Python docs:
epsilon - difference between 1 and the least value greater than 1 that is representable as a float
min - minimum positive normalized float
 
Mark44 said:
Machine epsilon and the smallest floating point number are different things.
From the Python docs:
epsilon - difference between 1 and the least value greater than 1 that is representable as a float
min - minimum positive normalized float
Oh that makes sense. Now what I even more puzzling is that I'm supposed to find a min floating point such that, it plus 1 should not return 1. Interestingly, the output I am getting when adding min float and 1 is 1.
 
BubblesAreUs said:
Oh that makes sense. Now what I even more puzzling is that I'm supposed to find a min floating point such that, it plus 1 should not return 1. Interestingly, the output I am getting when adding min float and 1 is 1.
That's really not that surprising. The smallest positive number that you can add to 1, and still get 1, is machine epsilon, which is many orders of magnitude larger than min.
 
BubblesAreUs said:
... I'm supposed to find a min floating point...
Why are we dealing with homework in this forum?
 
  • Like
Likes   Reactions: jim mcnamara
MrAnchovy said:
Why are we dealing with homework in this forum?
Good point.
@BubblesAreUs, this should have been posted in the Homework & Coursework section, under Engineering & Computer Science. For future posts of this nature, please put them in that forum section.
 

Similar threads

  • · Replies 28 ·
Replies
28
Views
5K
  • · Replies 32 ·
2
Replies
32
Views
2K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
1K
Replies
9
Views
2K
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
10
Views
4K