Logiweb(TM)

7.5.1 Numerals

Prev Up Next Page 186 of 800 Search internet


The base page defines the following macros for constructing numerals:

0
1
2
3
4
5
6
7
8
9
+"
-"
0"
1"
2"
3"
4"
5"
6"
7"
8"
9"

As an example, 117 is parsed as 1[1[7]] which macro expands into an expression whose value is 117.

The base page only supports decimal numerals and only supports numerals which denote integers. Support for floating point numerals, binary numerals, and octal numerals might be a good idea to add to the base page at some time in the future.

Support for hex numerals would definitely be a bad idea since constructs like a and A denote variables. If hex numerals are needed, it would be better to introduce a construct like "_16 and define it such that e.g.

"1A"_16

is rendered as

"\mathrm{1A}_{16}"

and such that

"\mathrm{1A}_{16}" == 26

If you, dear reader, need hex constants like those above, go ahead and define them. If you want to share your hex constant facilities, please publish them on Logiweb. Of course, the approach above also works for binary, octal, and floating point numerals which allows to introduce such literals without messing with the base page.

Prev Up Next Page 186 of 800 Search logiweb.eu

Copyright © 2010 Klaus Grue, GRD-2010-01-05