mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
docs: clarify how many number literal types are there
This commit is contained in:
parent
76dd85edfa
commit
a747f1d2c3
@ -169,9 +169,13 @@ Fixed Point Numbers
|
|||||||
Rational and Integer Literals
|
Rational and Integer Literals
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
Integer literals and rational number literals belong to a special type.
|
Solidity has a number literal type for each rational number.
|
||||||
The number literal type contains not just single literals
|
Integer literals and rational number literals belong to number literal types.
|
||||||
but all number literal expressions (i.e. the expressions that contain only number literals and operators).
|
Moreover, all number literal expressions (i.e. the expressions that
|
||||||
|
contain only number literals and operators) belong to number literal
|
||||||
|
types. So the number literal expressions `1 + 2` and `2 + 1` both
|
||||||
|
belong to the same number literal type for the rational number three.
|
||||||
|
|
||||||
Number literal expressions retain arbitrary precision until they are converted to a non-literal type (i.e. by
|
Number literal expressions retain arbitrary precision until they are converted to a non-literal type (i.e. by
|
||||||
using them together with a non-literal expression).
|
using them together with a non-literal expression).
|
||||||
This means that computations do not overflow and divisions do not truncate
|
This means that computations do not overflow and divisions do not truncate
|
||||||
|
Loading…
Reference in New Issue
Block a user