Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Single.Epsilon Field

Represents the smallest positive Single value greater than zero. This field is constant.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

public const float Epsilon
public static final float Epsilon
public const var Epsilon : float

The value of this constant is 1.4e-45.

Two apparently equivalent floating-point numbers might not compare equal because of differences in their least significant digits. For example, the C# expression, (float)1/3 == (float)0.33333, does not compare equal because the division operation on the left-hand side has maximum precision while the constant on the right-hand side is only precise to the specified digits.

If you create a custom algorithm that determines whether two floating-point numbers can be considered equal, you can use the Epsilon constant to establish the limits of that algorithm.

The following code example displays the Epsilon constant.

Console.WriteLine("Epsilon, or the permittivity of a vacuum, has value {0}", Single.Epsilon.ToString());

Console.WriteLine("Epsilon, or the permittivity of a vacuum, "
    + "has value {0}", String.valueOf(Single.Epsilon));

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0
© 2018 Microsoft