mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[TMP] mantissaExponent(): Allow full uint range for exponent
This commit is contained in:
parent
4899b854d8
commit
155c93580f
@ -1230,18 +1230,15 @@ pair<RationalNumberType const*, RationalNumberType const*> RationalNumberType::m
|
|||||||
bool negative = (m_value < 0);
|
bool negative = (m_value < 0);
|
||||||
rational const maxMantissa = (negative ? -minInt : maxUint);
|
rational const maxMantissa = (negative ? -minInt : maxUint);
|
||||||
|
|
||||||
int exponent = 0;
|
rational exponent = 0;
|
||||||
rational unsignedMantissa = abs(m_value);
|
rational unsignedMantissa = abs(m_value);
|
||||||
while (unsignedMantissa.denominator() != 1)
|
while (unsignedMantissa.denominator() != 1)
|
||||||
{
|
{
|
||||||
unsignedMantissa *= 10;
|
unsignedMantissa *= 10;
|
||||||
--exponent;
|
--exponent;
|
||||||
|
|
||||||
if (
|
// FIXME: What happens when exponent in scientific notation is max uint?
|
||||||
unsignedMantissa > maxUint ||
|
if (unsignedMantissa > maxMantissa || exponent > maxUint)
|
||||||
unsignedMantissa < minInt ||
|
|
||||||
exponent < -255 // TODO: sane value?
|
|
||||||
)
|
|
||||||
return {nullptr, nullptr};
|
return {nullptr, nullptr};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user