https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125255

            Bug ID: 125255
           Summary: Inaccurate printing of floating point values even when
                    numbers are exactly representable
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: algol68
          Assignee: algol68 at gcc dot gnu.org
          Reporter: jpl.algol68 at gmail dot com
  Target Milestone: ---

Created attachment 64420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64420&action=edit
Additional information received from N.H.F. Beebe

Two issues regarding IEEE754 with respect to inf and nan.

The first example below shows that divide by zero does not produce the expected
IEEE754 of inf.

begin
    real x, y, z;
    x := 1.0;
    y := 0.0;
    z := x / y;
    puts("If Algol 68 arithmetic follows IEEE 754, this should be Infinity: " +
        float(z, 30, 20, 0) + "'n");
   skip
end

Instead, this program enters and infinite loop. 


The second example shows 0.0/0.0 does not produced expected IEEE754 nan:

begin
    real x, y, z;
    x := 0.0;
    y := 0.0;
    z := x / y;
    puts("If Algol 68 arithmetic follows IEEE 754, this should be NaN: " +
        float(z, 30, 20, 0) + "'n");
   skip
end

Instead, this test file core dumps at run-time: 
standard.a68:429: runtime error: bound -2147483647 out of range [1:16]

This dump is believed to happen in: 

       proc dig_char = (int x) char: "0123456789abcdef"[x+1]; 

The procedure dig_char is called by `subfixed' and others. 

These examples were brought to our attention and contributed by Nelson H. F.
Beebe and are thankfully acknowledged.

Attachment contains additional related information received from N.H.F. Beebe.
  • [Bug algol68/125255] New: Inaccu... jpl.algol68 at gmail dot com via Gcc-bugs

Reply via email to