L int width definition problematic in RR

chris hermansen clhermansen@gmail.com
Sun Aug 23 05:31:34 GMT 2026


Good evening everyone,

The definition for L int width in the RR p. 163 seems problematic to
me.  Here it is:

int L int width =
   { the smallest integral value such that 'L max int' may be
     converted without error using the pattern n(L int width)d }
   (int C: = 1;
    while L 10 ^ (c - 1) < L .1 * L max int do c +:= 1 od;
    c);

It's kind of ugly but more than that, the constant

L .1 * L max int

isn't close to the desired value.  For example, max_int on x86 is

2147483647

whereas  max_int * 0.1 is

214748358.726

because there's just too many digits in max_int to convert "properly" to a real.

For the purposes of calculating L int width it seems to be OK on x86
but still, I'm not liking this kind of formula.
--
Chris Hermansen · clhermansen "at" gmail "dot" com

C'est ma façon de parler.


More information about the Algol68 mailing list