mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
23 lines
434 B
Solidity
23 lines
434 B
Solidity
type Length is uint;
|
|
|
|
function km(uint meters) pure suffix returns (Length) {
|
|
return Length.wrap(meters * 1000);
|
|
}
|
|
|
|
struct Float {
|
|
uint mantissa;
|
|
uint exponent;
|
|
}
|
|
|
|
function f(uint mantissa, uint exponent) pure suffix returns (Float memory) {
|
|
return Float(mantissa, exponent);
|
|
}
|
|
|
|
contract C {
|
|
Length public length = 5000 km;
|
|
Float public factor = 1.23 f;
|
|
}
|
|
// ----
|
|
// length() -> 5000000
|
|
// factor() -> 0x7b, 2
|