Keywords: pame

Subsections

- Arithmetic enquiries
  - Enquiries about precisions
  - Enquiries about ranges
  - Internal sizes of modes
  - Sizes used in binary transput
  - Particular arithmetic values
- Character set enquiries

# Environment enquiries

Algol 68 was the first programming language to contain declarations which enable a programmer to determine the characteristics of the implementation. The enquiries are divided into a number of different groups. The actual values of the Linux port of the a68toc compiler are placed in square brackets. Those defined in the Revised Report are marked with (RR).

## Arithmetic enquiries

These enquiries are so numerous that they are further subdivided.

### Enquiries about precisions

Any number of `LONG` or `SHORT` can be given in the mode specification of numbers, but only a few such modes are distinguishable in any implementation. The following environment enquiries tell which modes are distinguishable. Note particularly that there are more distinguishable precisions available for `INT` and `BITS` than there are for `REAL` and `COMPL` in the a68toc implementation.

`INT int lengths` (RR) [2]
  1 + the number of extra lengths of integers.
`INT int shorths` (RR) [3]
  1 + the number of short lengths of integers.
`INT real lengths` (RR) [1]
  1 + the number of extra lengths of real numbers.
`INT real shorths` (RR) [2]
  1 + the number of short lengths of real numbers.
`INT bits lengths` (RR) [2]
  1 + the number of extra lengths of `BITS`.
`INT bits shorths` (RR) [3]
  1 + the number of short lengths of `BITS`.
`INT bytes lengths` (RR) [0]
  Bytes are not implemented by the a68toc compiler.
`INT bytes shorths` (RR) [0]
  Bytes are not implemented by the a68toc compiler.

### Enquiries about ranges

`SHORT SHORT INT` `short short max int` (RR) [127]
  The maximum value of mode `SHORT SHORT INT`.
`SHORT INT short max int` (RR) [32 767]
  The maximum value of mode `SHORT INT`.
`INT max int` (RR) [2 147 483 647]
  The maximum value of mode `INT`.
`LONG INT long max int` (RR)
  [9 223 372 036 854 775 807] The maximum value of mode `LONG INT`.
`SHORT REAL short min real` [0.117 55e-37]
  The smallest representable short real. It should not be confused with `short small real`.
`SHORT REAL short max real` (RR) [0.340 28e+39]
  The largest short real value storable.
`SHORT REAL short small real` (RR)
  [1.192 09e-7] The smallest short real which, when added to 1.0 makes a discernible difference.
`REAL min real` [0.197 626 258 336 50e-322]
  The smallest representable real. It should not be confused with `small real`.
`REAL max real` (RR) [0.179 769 313 486 23e+309]
  The largest real value storable.
`REAL small real` (RR) [0.222 044 604 925 031e-15]
  The smallest real which, when added to 1.0, makes a discernible difference.
`INT bytes per bits` (RR) [4]
  Number of bytes for a machine word.

### Internal sizes of modes

`INT short short int width` [3]
  The maximum number of decimal digits expressible by a value of mode `SHORT SHORT INT`.
`INT short int width` [5]
  The maximum number of decimal digits expressible by a value of mode `SHORT INT`.
`INT int width` [10]
  The maximum number of decimal digits expressible by a value of mode `INT`.
`INT long int width` [19]
  The maximum number of decimal digits expressible by a value of mode `LONG INT`.
`INT short short bits width` (RR) [8]
  The number of bits required to hold a value of mode `SHORT SHORT BITS`.
`INT short bits width` (RR) [16]
  The number of bits required to hold a value of mode `SHORT BITS`.
`INT bits width` (RR) [32]
  The number of bits required to hold a value of mode `BITS`.
`INT long bits width` (RR) [64]
  The number of bits required to hold a value of mode `LONG BITS`.
`INT bytes width` (RR) [0]
  The mode `BYTES` is not implemented.
`INT short real precision` [24]
  The number of bits used for the mantissa of a short real.
`INT short real width` [6]
  The maximum number of significant decimal digits in a small real.
`INT short min exp` [- 125]
  The minimum exponent of a short real.
`INT short max exp` [128]
  The maximum exponent of a short real.
`INT short exp width` [2]
  The maximum number of decimal digits in the exponent of a short real. This can be less than the number of digits occupied by `short max exp` because any decimal digit can be represented. For example, 99 but not 999.
`INT real precision` [53]
  The number of bits used for the mantissa of a real.
`INT real width` [15]
  The maximum number of significant decimal digits in a real.
`INT min exp` [- 1021]
  The minimum exponent of a real.
`INT max exp` [1024]
  The maximum exponent of a real.
`INT exp width` [3]
  The maximum number of decimal digits in the exponent of a real. See also `short exp width`.

### Sizes used in binary transput

These values give the sizes of each mode when transput using `put bin` or `get bin`.

1. `INT long bits bin bytes` [8]
2. `INT bits bin bytes` [4]
3. `INT short bits bin bytes` [2]
4. `INT short short bits bin bytes` [1]
5. `INT bool bin bytes` [4]
6. `INT long int bin bytes` [8]
7. `INT int bin bytes` [4]
8. `INT short int bin bytes` [2]
9. `INT short short int bin bytes` [1]
10. `INT real bin bytes` [8]
11. `INT short real bin bytes` [4]
12. `INT compl bin bytes` [16]
13. `INT short compl bin bytes` [8]
14. `INT char bin bytes` [1]

### Particular arithmetic values

1. `REAL infinity`
   Defined by the C mathematics library as `HUGE_VAL`.
2. `SHORT REAL short pi` [3.14159]
3. `REAL pi` [3.141 592 653 589 79]
4. `REAL log2` [0.301 029 995 663 981] This is the value of log102.

## Character set enquiries

The a68toc implementation of Algol 68 is bedevilled by the peculiar limitations of the C programming language in which a character is actually an integer and indistinguishable from such. Furthermore, a C `character' is a signed integer, equivalent to a value of mode `SHORT SHORT INT`. Thus C `characters' range from -128 to +127. Algol 68, on the other hand, has the mode `CHAR` which, at a high level, is distinct from values of both mode `INT` and mode `SHORT SHORT INT`. The absolute value of Algol 68 characters range from 0 to the value of `max abs char`. Furthermore, the operator `REPR` will convert any `INT` upto `max abs char` to a character. Be warned that the C value of `REPR 225`, for example, is -31! What character is represented by `REPR 225` will depend on the character set used by the displaying device. An ISO 8859-1 character set, for example, will display `á'. The environment enquiries in this section are limited to a range enquiry and the values of commonly required characters.

1. `INT max abs char` (RR) [255]
   The largest positive integer which can be represented as a character.
2. `CHAR null character` (RR) [`REPR 0`]
3. `CHAR nul ch` [`REPR 0`] This is a synonym for `null character`.
4. `CHAR blank` (RR) [`REPR 32`] This is a space character.
5. `CHAR error char` (RR) [ `*` ] This character is used by the conversion routines for invalid values.
6. `CHAR flip` (RR) [T] This character is used to represent `TRUE` as an external value.
7. `CHAR flop` (RR) [F] This character is used to represent `FALSE` as an external value.
8. `CHAR cr` [`REPR 13`] This character is sometimes used as a line terminator, usually in association with `lf`.
9. `CHAR lf` [`REPR 10`] This character terminates lines on Linux.
10. `CHAR ff` [`REPR 12`] This character is the “form-feed” character often used for continuous stationery.
11. `CHAR tab ch` [`REPR 9`] This character is used to provide crude formatting of text files, particularly those which mimic documents produced by typewriters.
12. `CHAR esc` [`REPR 27`] This character is mainly used to introduce “escape sequences” which control the format and colour of output on Linux virtual terminals (VTs) and xterm windows.14.2
13. `CHAR eof char` [`REPR 26`]
    This character was used to denote the end of a plain text file in the MS-DOS operating system.