NUnit.Framework.Constraints.FloatingPointNumerics Class

Helper routines for working with floating point numbers

See Also: FloatingPointNumerics Members

public class **FloatingPointNumerics**

The floating point comparison code is based on this excellent article: http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm

"ULP" means Unit in the Last Place and in the context of this library refers to the distance between two adjacent floating point numbers. IEEE floating point numbers can only represent a finite subset of natural numbers, with greater accuracy for smaller numbers and lower accuracy for very large numbers.

If a comparison is allowed "2 ulps" of deviation, that means the values are allowed to deviate by up to 2 adjacent floating point values, which might be as low as 0.0000001 for small numbers or as high as 10.0 for large numbers.