Exemplo n.º 1
0
TValBool Real::Equal ( const Real & cv ) const
{
	// if both are undefined then are equals.
	if ( IsUndefined() && cv.IsUndefined() )
		return TValBool::ttrue;

	// if only one is undefined:
	else if ( IsUndefined() || cv.IsUndefined() )
		return TValBool::tundef;

	// else they are real numbers.
	return (rvalue >= cv.value() - RealPrecision::Tol.precision()  &&
		rvalue <= cv.value() + RealPrecision::Tol.precision() ) ?
		TValBool::ttrue : TValBool::tfalse;
}
Exemplo n.º 2
0
const Real Real::operator - (const Real &c) const
{
	if (IsUndefined() || c.IsUndefined())
		return Real();	// Devuelve un indefinido
	// else:
	return Real( value() - c.value() );
}
Exemplo n.º 3
0
const Real Real::operator / (const Real &c) const
{
	if (IsUndefined() || c.IsUndefined())
		return Real();	// Devuelve un indefinido
	if (c == zero)
		return Real();

	// else:
	return Real( value() / c.value() );
}
Exemplo n.º 4
0
TValBool Real::Less ( const Real & cv ) const
{
	// if both are undefined:
	if ( IsUndefined() && cv.IsUndefined() )
		return TValBool::tfalse;

	// if only one is undefined:
	else if ( IsUndefined() || cv.IsUndefined() )
		return TValBool::tundef;

	// else they are real numbers.
	return rvalue < cv.value();
}