From 4b3e1f140c80a50d0682f877215fbaeab3847aab Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Mon, 11 Apr 2016 16:35:17 -0500 Subject: much better way of doing modulus --- libsolidity/ast/Types.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'libsolidity/ast') diff --git a/libsolidity/ast/Types.cpp b/libsolidity/ast/Types.cpp index 343a7ea7..7558d715 100644 --- a/libsolidity/ast/Types.cpp +++ b/libsolidity/ast/Types.cpp @@ -703,14 +703,8 @@ TypePointer RationalNumberType::binaryOperatorResult(Token::Value _operator, Typ return TypePointer(); else if (fractional) { - value = m_value; - if (value > other.m_value) - { - do - { - value -= other.m_value; - } while (value > other.m_value); - } + rational tempValue = m_value / other.m_value; + value = m_value - (tempValue.numerator() / tempValue.denominator()) * other.m_value; } else value = m_value.numerator() % other.m_value.numerator(); -- cgit