mirror of
https://github.com/irmen/prog8.git
synced 2024-12-23 09:32:43 +00:00
document underscores in numeric literals for grouping
This commit is contained in:
parent
ef1c665b9a
commit
c7c72f00c7
@ -229,7 +229,7 @@ Integers
|
||||
^^^^^^^^
|
||||
|
||||
Integers are 8 or 16 bit numbers and can be written in normal decimal notation,
|
||||
in hexadecimal and in binary notation.
|
||||
in hexadecimal and in binary notation. You can use underscores to group digits to make long numbers more readable.
|
||||
A single character in single quotes such as ``'a'`` is translated into a byte integer,
|
||||
which is the PETSCII value for that character.
|
||||
|
||||
@ -260,6 +260,8 @@ This saves a lot of memory and may be faster as well.
|
||||
Floating point numbers
|
||||
^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
You can use underscores to group digits to make long numbers more readable.
|
||||
|
||||
Floats are stored in the 5-byte 'MFLPT' format that is used on CBM machines.
|
||||
Floating point support is available on the c64 and cx16 (and virtual) compiler targets.
|
||||
On the c64 and cx16, the rom routines are used for floating point operations,
|
||||
|
@ -399,6 +399,10 @@ Note that ``%`` is also the remainder operator so be careful: if you want to tak
|
||||
of something with an operand starting with 1 or 0, you'll have to add a space in between.
|
||||
Otherwise the parser thinks you've typed an invalid binary number.
|
||||
|
||||
**digit grouping:** for any number you can use underscores to group the digits to make the
|
||||
number more readable. Any underscores in the number are ignored by the compiler.
|
||||
For instance ``%1001_0001`` is a valid binary number and ``3_000_000.99`` is a valid floating point number.
|
||||
|
||||
**character values:** you can use a single character in quotes like this ``'a'`` for the PETSCII byte value of that character.
|
||||
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
TODO
|
||||
====
|
||||
|
||||
- document underscores in numeric literals for grouping
|
||||
|
||||
- [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 ....
|
||||
|
||||
...
|
||||
|
@ -5,7 +5,7 @@
|
||||
<option name="COMMENT_START" value="/*" />
|
||||
<option name="COMMENT_END" value="*/" />
|
||||
<option name="HEX_PREFIX" value="$" />
|
||||
<option name="NUM_POSTFIXES" value="" />
|
||||
<option name="NUM_POSTFIXES" value="_" />
|
||||
<option name="HAS_BRACES" value="true" />
|
||||
<option name="HAS_BRACKETS" value="true" />
|
||||
<option name="HAS_PARENS" value="true" />
|
||||
@ -17,7 +17,7 @@
|
||||
<keywords4 keywords="abs;all;any;callfar;callram;callrom;clamp;cmp;divmod;len;lsb;max;memory;min;mkword;msb;peek;peekf;peekw;poke;pokef;pokew;pop;popw;push;pushw;reverse;rol;rol2;ror;ror2;rrestore;rrestorex;rsave;rsavex;setlsb;setmsb;sgn;sizeof;sort;sqrt;swap;|>" />
|
||||
</highlighting>
|
||||
<extensionMap>
|
||||
<mapping ext="prog8" />
|
||||
<mapping ext="p8" />
|
||||
<mapping ext="prog8" />
|
||||
</extensionMap>
|
||||
</filetype>
|
Loading…
Reference in New Issue
Block a user