{: test that non integer exponent of negative number causes a fatal error }

{d+}
program d1001( output );

var
   k : integer;
   x : real;

function side : integer;
begin
   side := k;
   k := k+1;
end;
begin {d1001}

   k := 10;
   writeln( '3**10 is ', 3**side:1:2);
   if k <> 11 then
      writeln( 'exponential operator for debug has side effects' );
   writeln( '1.5**11 is ', 1.5**side:1:5);
   if k <> 12 then
      writeln( 'exponential operator for debug has side effects' );
   writeln( '12**2 is ', side**2:1:2);
   if k <> 13 then
      writeln( 'exponential operator for debug has side effects' );
   writeln( '13**2.5 is ', side**2.5:1:3);
   if k <> 14 then
      writeln( 'exponential operator for debug has side effects' );

   x := 0**(-1);
   writeln( '0**(-1) is ', x:1:2 ); // inf

   x := 0**(-1.5);
   writeln( '0**(-1.5) is ', x:1:2 ); // inf

   x := (-3)**(1/3);              { fatal error }
   writeln( 'x is ', x:1:2 );

   writeln( 'fails: non integer power of negative number is not detected' );
end. { d1001 }

