mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Fix literals with exponents with mantissa of zero.
This commit is contained in:
		
							parent
							
								
									f3abfa81ad
								
							
						
					
					
						commit
						e8e5e12ad2
					
				| @ -771,7 +771,17 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal | ||||
| 		} | ||||
| 		else if (expPoint != _literal.value().end()) | ||||
| 		{ | ||||
| 			// Parse base and exponent. Checks numeric limit.
 | ||||
| 			// Parse mantissa and exponent. Checks numeric limit.
 | ||||
| 			tuple<bool, rational> mantissa = parseRational(string(_literal.value().begin(), expPoint)); | ||||
| 
 | ||||
| 			if (!get<0>(mantissa)) | ||||
| 				return make_tuple(false, rational(0)); | ||||
| 			value = get<1>(mantissa); | ||||
| 
 | ||||
| 			// 0E... is always zero.
 | ||||
| 			if (value == 0) | ||||
| 				return make_tuple(true, rational(0)); | ||||
| 
 | ||||
| 			bigint exp = bigint(string(expPoint + 1, _literal.value().end())); | ||||
| 
 | ||||
| 			if (exp > numeric_limits<int32_t>::max() || exp < numeric_limits<int32_t>::min()) | ||||
| @ -779,13 +789,6 @@ tuple<bool, rational> RationalNumberType::isValidLiteral(Literal const& _literal | ||||
| 
 | ||||
| 			uint32_t expAbs = bigint(abs(exp)).convert_to<uint32_t>(); | ||||
| 
 | ||||
| 
 | ||||
| 			tuple<bool, rational> base = parseRational(string(_literal.value().begin(), expPoint)); | ||||
| 
 | ||||
| 			if (!get<0>(base)) | ||||
| 				return make_tuple(false, rational(0)); | ||||
| 			value = get<1>(base); | ||||
| 
 | ||||
| 			if (exp < 0) | ||||
| 			{ | ||||
| 				if (!fitsPrecisionBase10(abs(value.denominator()), expAbs)) | ||||
|  | ||||
| @ -19,6 +19,7 @@ contract c { | ||||
|         a = 1E1233 ** -1E1233; | ||||
|         a = -1E1233 ** 1E1233; | ||||
|         a = -1E1233 ** -1E1233; | ||||
|         a = 0E123456789; // fine | ||||
|     } | ||||
| } | ||||
| // ---- | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user