Function necsim::doubleCompare(long double, long double, double)

Function Documentation

bool necsim::doubleCompare(long double d1, long double d2, double epsilon)

Compares two doubles and returns a boolean of whether they are equal, within the epsilon deviation. This is useful for floating point errors in saving and reading doubles from file. Overloaded version for long doubles and double epsilon.

true if the doubles are within epsilon of each other
  • d1: the first double.
  • d2: the second double.
  • epsilon: the deviation within which the values are assumed to be equal.