diff options
author | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 17:54:40 +0800 |
---|---|---|
committer | Yoichi Hirai <i@yoichihirai.com> | 2016-11-25 17:54:40 +0800 |
commit | a747f1d2c32c691b00f3b24fead8436195eb555e (patch) | |
tree | eb01429f0c23fca815aa1b7e0669b07c4d0063e1 | |
parent | 76dd85edfacb1909a7de5807d369e69c8558deac (diff) | |
download | dexon-solidity-a747f1d2c32c691b00f3b24fead8436195eb555e.tar.gz dexon-solidity-a747f1d2c32c691b00f3b24fead8436195eb555e.tar.zst dexon-solidity-a747f1d2c32c691b00f3b24fead8436195eb555e.zip |
docs: clarify how many number literal types are there
-rw-r--r-- | docs/types.rst | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/docs/types.rst b/docs/types.rst index 85309f60..83b0a098 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -169,9 +169,13 @@ Fixed Point Numbers Rational and Integer Literals ----------------------------- -Integer literals and rational number literals belong to a special type. -The number literal type contains not just single literals -but all number literal expressions (i.e. the expressions that contain only number literals and operators). +Solidity has a number literal type for each rational number. +Integer literals and rational number literals belong to number literal types. +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 using them together with a non-literal expression). This means that computations do not overflow and divisions do not truncate |