[RFC] We need an ENTIER that does ceil, CENTIER?
Paul Leyland
paul.leyland@gmail.com
Sat May 16 08:28:17 GMT 2026
On 16/05/2026 03:11, algol68-request@gcc.gnu.org wrote:
> Date: Fri, 15 May 2026 23:07:42 +0200
> From: "Jose E. Marchesi"<jemarch@gnu.org>
> To:algol68@gcc.gnu.org
> Subject: Re: [RFC] We need an ENTIER that does ceil, CENTIER?
> Message-ID:<871pfc5qld.fsf@gnu.org>
> Content-Type: text/plain
>
>
> Sooo, I found this in the PDP-11 ALGOL 68S manual:
>
> ----
> # Two flavors of real-to-integer conversion #
>
> round 1.6 yields 2 proc (real) int
> entier 1.6 yields 1 proc (real) int
> round -1.4 yields -1
> entier -1.4 yields -2
> ----
>
> They use ROUND for ceil.
>
> I suggest we do the same, as there is at least some established
> tradition about it..
I suggest not. CEIL (or CEILING as second-best) unambiguously indicates
rounding up. ROUND, to me at least, could mean round up, round down or
round to nearest.
It gets worse. On p16 of "An Introduction to Algol 68 through Problems"
by A Learner and AJ Powell (ISBN 0 33 16620 5)which uses Algol 68-R for
its examples we find:
'a := round x' assigns the nearest whole number to the value of x
to the integer a.
'entier x is the greatest integer <= x.
This tome uses Algol 68R.
The explanation in "Algol 68-R Users Guide (ISBN 0 11 771600 6) is
somewhat more explicit The text on page 93 reads:
ROUND 10 applied to REAL, gives the nearest INT. In critical
cases, round up.
Pagan's "A Practical Guide to Algol 68' does not specify which compiler
is targeted but uses the "nearest whole number" formulation. Genie does
the same on page 220 of
https://algol68-lang.org/docs/learning-algol-68-genie.pdf
My take is that if we follow tradition in using ROUND we end up getting
an undesirable result half the time or have to remember to add 0.5
before ROUNDing.
Mathematical usage in English is invariably floor and ceiling, likely
because of the ambiguity concern. Given that ENTIER is already built in
to the language and yet is not used in any other language AFAIK, I see
relatively little attraction in the established tradition argument.
Paul
More information about the Algol68
mailing list