int main(int argc, char *argv[])
{

    float f1 = 22.12345;
    float f2 = 22.12344;
    float f3 = 11.12345;
    assert(float_equal(f1, f2));
    assert(float_equal(f2, f1));
    assert(!float_equal(f2, f3));
    return 0;
}
/**
	Equality operators
*/
bool v_edge::operator==(const v_edge& other) const
{
	return (float_equal(this->x1, other.x1) && float_equal(this->x2, other.x2)
		&& float_equal(this->y1, other.y1) && float_equal(this->y2, other.y2))
		|| (flippable && float_equal(this->x1, other.x2) && float_equal(this->x2, other.x1)
		&& float_equal(this->y1, other.y2) && float_equal(this->y2, other.y1));
}
Beispiel #3
0
void ElAnimation::setSpeed(float speed)
{
	if (!float_equal(mSpeed, speed))
	{
		if (mPlaying)
		{
			TimeValue newPastTime = mPastTime * (speed / mSpeed);
			mStartTime = mStartTime + (mPastTime - newPastTime);
		}

		mSpeed = speed;
	}
}
string const ResizeLatexOption::option_impl() const
{
	if (data.no_resize())
		return string();

	ostringstream os;
	if (data.usingScale()) {
		double const scl = convert<double>(data.scale);
		if (!float_equal(scl, 100.0, 0.05))
			os << "scale=" << scl / 100.0 << ',';
		return os.str();
	}

	if (!data.width.zero())
		os << "width=" << data.width.asLatexString() << ',';
	if (!data.height.zero())
		os << "height=" << data.height.asLatexString() << ',';
	if (data.keepAspectRatio)
		os << "keepaspectratio,";

	return os.str();
}
bool ResizeData::usingScale() const
{
	return (!scale.empty() && !float_equal(convert<double>(scale), 0.0, 0.05));
}
/**
	Methods for wheter input edge is the follwer of this edge
*/
bool v_edge::follows_strict(const v_edge& e) const
{
	return float_equal(x2, e.x1) && float_equal(y2, e.y1);
}