The machine epsilon is canonically defined as the smallest number which added to one, gives a result different from one.
There is a Double.Epsilon
but t
Just hard-code the value:
const double e1 = 2.2204460492503131e-16;
or use the power of two:
static readonly double e2 = Math.Pow(2, -52);
or use your definition (more or less):
static readonly double e3 = BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(1.0) + 1L) - 1.0;
And see Wikipedia: machine epsilon.