Esempio n. 1
0
int UlpsDiff(float A, float B)
{
    Float_t uA(A);
    Float_t uB(B);

    return abs(uA.i - uB.i);
}
Esempio n. 2
0
bool Double::operator==(const double& dblB) const {
	if (almostEqualAbs(dblB))
		return true;
	int ulpsDiff;
	Double_t uA(_val);
	Double_t uB(dblB);
	return almostEqualUlps(uA, uB, &ulpsDiff);
}
Esempio n. 3
0
bool Double::operator>(const double& dblB) const {
	if (almostEqualAbs(dblB))
		return true;
	int ulpsDiff;
	Double_t uA(_val);
	Double_t uB(dblB);
	bool ret = almostEqualUlps(uA, uB, &ulpsDiff);
	if (ret)
		return false;
	if (uA.i > uB.i)
		return true;
	return false;
}
bool AlmostEqualUlps(float A, float B) {
    SkPathOpsUlpsFloat uA(A);
    SkPathOpsUlpsFloat uB(B);
    // Different signs means they do not match.
    if (uA.negative() != uB.negative())
    {
        // Check for equality to make sure +0 == -0
        return A == B;
    }
    // Find the difference in ULPs.
    int ulpsDiff = abs(uA.fInt - uB.fInt);
    return ulpsDiff <= UlpsEpsilon;
}
Esempio n. 5
0
double Tolerance::UlpsDiffDouble(double A, double B) const
{
  Double_t uA(A);
  Double_t uB(B);

  // Different signs means they do not match.
  if (uA.Negative() != uB.Negative()) {
    // Check for equality to make sure +0==-0
    if (A == B)
      return 0.0;
    return 2 << 28;
  }

  // Find the difference in ULPs.
  return std::abs(uA.i - uB.i);
}