What "Machine epsilon" means | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What "Machine epsilon" means

Hi, im doing a project to school and i was given this topic which i dont understand much because there are no text a about on internet in my language. Can u please give me a hand?

1st Oct 2018, 9:07 PM
Oliver Ondrus
Oliver Ondrus - avatar
2 Answers
+ 5
In English...I hope there is enough interactivity here to help you see. ~ There are two definitions for epsilon, both related to how computers estimate floating point numbers. *** PART 1 *** First, please know that computers represent floating point numbers _inexactly_ https://code.sololearn.com/WYCTOysAGnLv/?ref=app ~ Try 0.1 in the "Expression": The blue text shows: 0.100000000000000005551 It is the closest approximation the computer has to 0.10000... It is not exact, but that is probably okay. ~ Try 0.2. It is also _inexact_ ~ Compare the endings of 0.1 and 0.2: 0.100...05551 0.200...11102 ~ If we add those numbers, we expect 0.300....16653: 0.300...44409 (?!) ~ Now type 0.3: 0.29999999... (?!) This is why 0.1+0.2 is often NOT 0.3! Floating point decimals are estimated. See part 2.
1st Oct 2018, 11:55 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
*** PART 2 *** Set "expression" to 1. Press the [Next] button. Three things change: * Expression: 1.0000000000000002 * Blue text: 1.00000000000000022204 * Epsilon: 2.22044604925031308085e-16 Notice, the end of the blue text looks exactly like the start of epsilon. Definition 1 (ISO C standard): Epsilon is the relative error when trying to represent a floating point number. or: "the difference between 1 and the next nearest number representable as a machine number." Proof: No number between 1.000 and the next number can be represented: 1.0000000000000001 -> rounds DOWN : 1.000...000 1.0000000000000002 -> rounds UP : 1.000...22204 The gap is ~epsilon (#1). Definition 2 (SCILAB): Epsilon is the number that you add to 1, which results in NOT 1. It is the point at which the computer rounds UP or DOWN (halfway). 1 + 1.11022302462515666368314810e-16 == 1.000...00000 1 + 1.11022302462515666368314811e-16 == 1.000...22204 The halfway point is ~epsilon (#2).
1st Oct 2018, 11:56 PM
Kirk Schafer
Kirk Schafer - avatar