diff options
author | VoR0220 <catalanor0220@gmail.com> | 2016-04-12 05:35:17 +0800 |
---|---|---|
committer | VoR0220 <catalanor0220@gmail.com> | 2016-05-10 00:41:03 +0800 |
commit | 4b3e1f140c80a50d0682f877215fbaeab3847aab (patch) | |
tree | c2992faca0fdffb255d174119c49eff8f82ff80e | |
parent | 82039b732eb8855a5a9fac228734bf16081071c8 (diff) | |
download | dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.gz dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.zst dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.zip |
much better way of doing modulus
-rw-r--r-- | libsolidity/ast/Types.cpp | 10 |
1 files changed, 2 insertions, 8 deletions
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(); |