diff options
author | chriseth <chris@ethereum.org> | 2018-08-09 03:36:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-09 03:36:57 +0800 |
commit | d634d20b5b0dac3e5caf1741073fa123fdd56ab9 (patch) | |
tree | e88008bc8a8e665d32d8ac8c9125595dd90e8a22 /docs | |
parent | 551343ae3eb1b3f1575d91a4f7021c0f9529d5bd (diff) | |
parent | b9222808f61e00833f8c11cd196cafb50ec9e1b9 (diff) | |
download | dexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.tar.gz dexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.tar.zst dexon-solidity-d634d20b5b0dac3e5caf1741073fa123fdd56ab9.zip |
Merge pull request #4684 from ethereum/underscores_in_numeric_literals
[BREAKING] Underscores in numeric literals
Diffstat (limited to 'docs')
-rw-r--r-- | docs/types.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/types.rst b/docs/types.rst index fbc83972..5c4a30ca 100644 --- a/docs/types.rst +++ b/docs/types.rst @@ -284,6 +284,11 @@ one side. Examples include ``1.``, ``.1`` and ``1.3``. Scientific notation is also supported, where the base can have fractions, while the exponent cannot. Examples include ``2e10``, ``-2e10``, ``2e-10``, ``2.5e1``. +Underscores can be used to separate the digits of a numeric literal to aid readability. +For example, decimal ``123_000``, hexadecimal ``0x2eff_abde``, scientific decimal notation ``1_2e345_678`` are all valid. +Underscores are only allowed between two digits and only one consecutive underscore is allowed. +There is no additional semantic meaning added to a number literal containing underscores. + 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 |