mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Update types.rst
This commit is contained in:
parent
a747f1d2c3
commit
a755805879
@ -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
|
||||
@ -198,6 +191,14 @@ long as the operands are integers. If any of the two is fractional, bit operatio
|
||||
and exponentiation is disallowed if the exponent is fractional (because that might result in
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user