mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support negative exponent
This commit is contained in:
parent
6014c3fe16
commit
1083e6da68
@ -584,8 +584,7 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal
|
|||||||
if (expPoint != _literal.value().end())
|
if (expPoint != _literal.value().end())
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
!all_of(_literal.value().begin(), expPoint, ::isdigit) ||
|
!all_of(_literal.value().begin(), expPoint, ::isdigit)
|
||||||
!all_of(expPoint + 1, _literal.value().end(), ::isdigit)
|
|
||||||
)
|
)
|
||||||
return make_tuple(false, rational(0));
|
return make_tuple(false, rational(0));
|
||||||
|
|
||||||
@ -595,10 +594,16 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal
|
|||||||
return make_tuple(false, rational(0));
|
return make_tuple(false, rational(0));
|
||||||
|
|
||||||
x = bigint(string(_literal.value().begin(), expPoint));
|
x = bigint(string(_literal.value().begin(), expPoint));
|
||||||
x *= boost::multiprecision::pow(
|
if (exp < 0)
|
||||||
bigint(10),
|
x /= boost::multiprecision::pow(
|
||||||
exp.convert_to<int32_t>()
|
bigint(10),
|
||||||
);
|
abs(exp).convert_to<int32_t>()
|
||||||
|
);
|
||||||
|
else
|
||||||
|
x *= boost::multiprecision::pow(
|
||||||
|
bigint(10),
|
||||||
|
exp.convert_to<int32_t>()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else if (radixPoint != _literal.value().end())
|
else if (radixPoint != _literal.value().end())
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user