[RFC] CEIL, FLOOR, ROUND returning REAL

Pietro Monteiro pietro.gcc@sociotechnical.xyz
Mon May 18 05:13:54 GMT 2026


On Mon, May 18, 2026, at 1:06 AM, Pietro Monteiro wrote:
> On Mon, May 18, 2026, at 12:39 AM, chris hermansen wrote:
>> Piero and everyone,
>>
>> On Sun, May 17, 2026, 21:27 Pietro Monteiro <pietro@sociotechnical.xyz> wrote:
>>> While working on implementing CEIL I realized that CEIL, FLOOR, ROUND
>>> return an integer of same SIZETY as the real operand. I fortunately
>>> don't much involving floating point math, but I think that returning a
>>> real of same SIZETY as the operand might be usefull. What do y'all
>>> think?
>>
>> I think the length of the result should be the same as that of the operand.
>>
>> But I'm not sure I'm following you completely; ENTIER returns an INT, 
>> LONG INT OR LONG LONG INT, not reals. But your subject line suggests 
>> you plan to return real results from CEIL, FLOOR, ROUND?
>
> I was trying to propose adding CEIL, FLOOR/ENTIER and ROUND that would return
> a real of the same length of the operand in addition to the ones that
> return an integer.
>
>> I guess an error is thrown if the operand is outside the range 
>> representable by INT, LONG INT, LONG LONG INT respectively?
>
> I'm not sure. I'll try to test it soonish.

$ cat <<EOF > foo.a68
begin int foo  = ENTIER 3.40282346639e+38;
puts ("foo: " + REPR foo + "'n")
end
EOF
$ ga68 foo.a68 -o foo
$ ./foo
foo.a68:7: runtime error: -2147483648 is not a valid character point
Aborted (core dumped)

The error is about the "REPR foo" not the fact that the the operand is outside the range of INT.

pietro



More information about the Algol68 mailing list