# Return to Answer

 6 replaced http://programmers.stackexchange.com/ with https://softwareengineering.stackexchange.com/ edited Apr 12 '17 at 7:31 Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` The definition of machine epsilon is consistent with the general use of epsilon described above. Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answerGlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` The definition of machine epsilon is consistent with the general use of epsilon described above. Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` The definition of machine epsilon is consistent with the general use of epsilon described above. Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. 5 added 1686 characters in body edited Aug 11 '13 at 17:47 assylias 1,12988 silver badges1818 bronze badges Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` The definition of machine epsilon is consistent with the general use of epsilon described above. Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` The definition of machine epsilon is consistent with the general use of epsilon described above. Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. 4 added 1686 characters in body edited Aug 11 '13 at 17:41 assylias 1,12988 silver badges1818 bronze badges Delta is generally usedEpsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to name amachine espilon which measures the difference, between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be of any scale.calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` Epsilon is generally usedComparing floats Note however that before comparing floats for "proximity", you need to name a negligible quantityhave an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` In your caseAnd inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon seems more appropriate"only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` See alsoThe article linked in Greek letters in mathsGlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. Delta is generally used to name a difference, which can be of any scale. Epsilon is generally used to name a negligible quantity. In your case epsilon seems more appropriate. See also Greek letters in maths. Epsilon in maths and engineering In maths and engineering in general: Delta is generally used to refer to a difference, which can be of any scale. Epsilon is generally used to refer to a negligible quantity. and epsilon seems more appropriate in your case. Epsilon in computer science In computer science in particular, the term epsilon also refers to machine espilon which measures the difference between `1.0f` and the smallest float which is strictly larger than `1.0f`. That latter number is `1.00000011920928955078125f` for floats in Java and can be calculated with: ``````float f = Float.intBitsToFloat(Float.floatToIntBits(1f) + 1); `````` Comparing floats Note however that before comparing floats for "proximity", you need to have an idea of their scale. Two very large and supposedly very different float can be equal: ``````9223372036854775808f == 9223372036854775808f + 1000000000f; //this is true! `````` And inversely, there might be many possible float values (and several orders of magnitude) between two small floats which differ by the machine epsilon "only". In the example below, there are 10,000,000 available float values between `small` and `f`, but their difference is still well below the machine epsilon: ``````float small = Float.MIN_VALUE; // small = 1.4E-45 float f = Float.intBitsToFloat(Float.floatToIntBits(small) + 100000000); // f = 2.3122343E-35 boolean b = (f - small < 0.00000011920928955078125f); //true! `````` The article linked in GlenH7's answer investigates float comparison further and proposes several solutions to overcome these issues. 3 added 2 characters in body edited Aug 10 '13 at 21:55 Jon Purdy 17.5k55 gold badges5252 silver badges9191 bronze badges 2 added 142 characters in body edited Aug 7 '13 at 21:53 assylias 1,12988 silver badges1818 bronze badges 1 answered Aug 7 '13 at 21:45 assylias 1,12988 silver badges1818 bronze badges