aboutsummaryrefslogtreecommitdiffstats
path: root/docs/types.rst
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-25 21:51:38 +0800
committerGitHub <noreply@github.com>2016-11-25 21:51:38 +0800
commita755805879eb3cfb22bbe3845dc61a288f64a0e0 (patch)
treed3653888e4033e621fb840a33b0fc4cc358a957e /docs/types.rst
parenta747f1d2c32c691b00f3b24fead8436195eb555e (diff)
downloaddexon-solidity-a755805879eb3cfb22bbe3845dc61a288f64a0e0.tar.gz
dexon-solidity-a755805879eb3cfb22bbe3845dc61a288f64a0e0.tar.zst
dexon-solidity-a755805879eb3cfb22bbe3845dc61a288f64a0e0.zip
Update types.rst
Diffstat (limited to 'docs/types.rst')
-rw-r--r--docs/types.rst15
1 files changed, 8 insertions, 7 deletions
diff --git a/docs/types.rst b/docs/types.rst
index 83b0a098..0436fc70 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -169,13 +169,6 @@ Fixed Point Numbers
Rational and Integer Literals
-----------------------------
-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
@@ -199,6 +192,14 @@ and exponentiation is disallowed if the exponent is fractional (because that mig
a non-rational number).
.. note::
+ 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.
+
+.. note::
Most finite decimal fractions like ``5.3743`` are not finitely representable in binary. The correct type
for ``5.3743`` is ``ufixed8x248`` because that allows to best approximate the number. If you want to
use the number together with types like ``ufixed`` (i.e. ``ufixed128x128``), you have to explicitly