mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
much better way of doing modulus
This commit is contained in:
parent
82039b732e
commit
4b3e1f140c
@ -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();
|
||||||
|
Loading…
Reference in New Issue
Block a user