[Oberon] OBNC Sets incorrect output
Jörg
joerg.straube at iaeth.ch
Sun Mar 20 12:20:44 CET 2022
If the largest set element is 31, the set size is 32 {0..31}
Jörg
> Am 20.03.2022 um 10:37 schrieb Joe Turner <medianjoe at mailfence.com>:
>
>
> If you build OBNC on a 64 bit system with --c-int-type=long you can use integers between 0-63 in sets. I confirmed this using the code provided on the FAQ page at the OBNC site (slightly modified because I removed the procedure):
>
>
> MODULE setSize;
> IMPORT Out;
> VAR
> x : INTEGER;
> s : SET;
> BEGIN
> x := -1;
> s :=-{};
> REPEAT
> INC(x);
> EXCL(s,x)
> UNTIL s = {};
> Out.Int(x,4);
> Out.Ln
> END setSize.
>
> The output is 63.
>
> However, the following code should produce the output : 31 32.
>
> MODULE testsets;
> IMPORT Out;
> VAR
> i : INTEGER;
> x,y,z : SET;
> BEGIN
> x := {31,32,33};
> y := {33,34,35};
> z := x - y;
> FOR i := 31 TO 35 DO
> IF i IN z THEN
> Out.Int(i,4)
> END
> END;
> Out.Ln
> END testsets.
>
> But it doesn't. The output is 31. Other set operations also produce output limited to a maximum set size of 31.
> -- Sent with https://mailfence.com Secure and private email --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20220320/823511a5/attachment.html>
More information about the Oberon
mailing list