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);
|
||||
rational const maxMantissa = (negative ? -minInt : maxUint);
|
||||
|
||||
int exponent = 0;
|
||||
rational exponent = 0;
|
||||
rational unsignedMantissa = abs(m_value);
|
||||
while (unsignedMantissa.denominator() != 1)
|
||||
{
|
||||
unsignedMantissa *= 10;
|
||||
--exponent;
|
||||
|
||||
if (
|
||||
unsignedMantissa > maxUint ||
|
||||
unsignedMantissa < minInt ||
|
||||
exponent < -255 // TODO: sane value?
|
||||
)
|
||||
// FIXME: What happens when exponent in scientific notation is max uint?
|
||||
if (unsignedMantissa > maxMantissa || exponent > maxUint)
|
||||
return {nullptr, nullptr};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user