solidity/test/libsolidity/syntaxTests/literalSuffixes/suffixableLiterals/suffixed_decimal.sol
Kamil Śliwak 8adf89f042 Test cases
2022-08-11 09:37:32 +02:00

60 lines
1.6 KiB
Solidity

struct Decimal {
uint mantissa;
uint exponent;
}
function e(uint mantissa, uint exponent) pure returns (Decimal memory) {
return Decimal(mantissa, exponent);
}
contract C {
function f() public pure {
0.1 e;
0.100000 e;
0.123456 e;
0.0000000000000000000000000000000000000000000000000000000000000000000000000000001 e;
0.115792089237316195423570985008687907853269984665640564039457584007913129639935 e; // (2**256 - 1) * 10**-78
// Decimal with separators
1_2_3_4_5_6_7_8_9_0.1_2_3_4_5_6_7_8_9_0 e;
1_000.1234 e;
1_000.123_456 e;
1_000_000.123 e;
1_000_000.123_456_789 e;
// Scientific notation
1e-01 e;
1e-1 e;
1e-10 e;
1234e-10 e;
1e-80 e;
// Scientific notation with decimals
0.1e0 e;
0.1e-0 e;
0.1e-1 e;
0.1e-10 e;
1.1e0 e;
10.1e0 e;
100.1_111e-2 e;
10.000000000000111e10 e;
1.23e0 e;
1.23e1 e;
1.23e-1 e;
10.1e-1 e;
1000.1e-0003 e;
1200.1e-2 e;
0.00115792089237316195423570985008687907853269984665640564039457584007913129639935e2 e; // (2**256 - 1) * 10**-80 * 10**2
0.00115792089237316195423570985008687907853269984665640564039457584007913129639935e-2 e; // (2**256 - 1) * 10**-80 * 10**-2
// Scientific notation with separators
1_2_34e-10 e;
1_0.123456789123e1_0 e;
1.123_456e3 e;
10_000_000_000.123456789123e1_0 e;
10_000_000_000.1_234_56789_123e1_0 e;
10_000_000_000.1e-0_0_0_1_0 e;
}
}