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 greater than zero. This field is constant.

[Visual Basic]
Public Const Epsilon As Single
public const float Epsilon;
public: const float Epsilon;
public 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 visible digits.

Instead, determine if the two sides of a comparison are close enough to equal for your purposes by comparing whether the absolute value of the difference between the left and right-hand sides is less than Epsilon.


[Visual Basic, C#, C++] The following sample displays the Epsilon constant.

[Visual Basic] 
Console.WriteLine("Epsilon, or the permittivity of a vacuum, has value " + Single.Epsilon.ToString())

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

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

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework, Common Language Infrastructure (CLI) Standard

See Also

Single Structure | Single Members | System Namespace

© 2017 Microsoft