much better way of doing modulus

This commit is contained in:
VoR0220 2016-04-11 16:35:17 -05:00
parent 82039b732e
commit 4b3e1f140c

View File

@ -703,14 +703,8 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ
return TypePointer(); return TypePointer();
else if (fractional) else if (fractional)
{ {
value = m_value; rational tempValue = m_value / other.m_value;
if (value > other.m_value) value = m_value - (tempValue.numerator() / tempValue.denominator()) * other.m_value;
{
do
{
value -= other.m_value;
} while (value > other.m_value);
}
} }
else else
value = m_value.numerator() % other.m_value.numerator(); value = m_value.numerator() % other.m_value.numerator();