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

            Bug ID: 125254
           Summary: Improper IEEE754 arithmetic results with Inf and NaN
           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: ---

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 produce 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.

Reply via email to