aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorVoR0220 <catalanor0220@gmail.com>2016-04-12 05:35:17 +0800
committerVoR0220 <catalanor0220@gmail.com>2016-05-10 00:41:03 +0800
commit4b3e1f140c80a50d0682f877215fbaeab3847aab (patch)
treec2992faca0fdffb255d174119c49eff8f82ff80e /libsolidity
parent82039b732eb8855a5a9fac228734bf16081071c8 (diff)
downloaddexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.gz
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.bz2
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.lz
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.xz
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.tar.zst
dexon-solidity-4b3e1f140c80a50d0682f877215fbaeab3847aab.zip
much better way of doing modulus
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/ast/Types.cpp10
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();