Hi, all.
I've been moving an old program over to GPC, and ran across the following. Apparently the '**' operator works fine on variables, but it crashes if I put a hard-coded numerical value in for the base. The old y^x = exp(y ln x) workaround from Turbo seems to work fine. I don't know whether this is a new or a known bug.
Toby Ewing ewing@iastate.edu 515/294-7856 http://www.agron.iastate.edu/soilphysics/ewing.html Soil Scientist, Iowa State University
---------------------------------------------------
program StarStar(input, output);
var y : real; x : real value 10.0;
begin writeln('via exp(x ln y):'); {all these are fine} y := 5.557; write('variables, y > 0 '); writeln('exp(y ln x) = ', exp(y * ln(x)));
y := -5.557; write('variables, y < 0 '); writeln('exp(y ln x) = ', exp(y * ln(x)));
y := 5.557; write('constants, y > 0 '); writeln('exp(y ln x) = ', exp(y * ln(10.0)));
y := -5.557; write('constants, y < 0 '); writeln('exp(y ln x) = ', exp(y * ln(10.0))); readln;
writeln('via y ** x:'); {now for problems} y := 5.557; write('variables, y > 0 '); writeln(' x ** y = ', (x ** y));
y := -5.557; write('variables, y < 0 '); writeln(' x ** y = ', (x ** y));
y := 5.557; write('constants, y > 0 '); writeln(' x ** y = ', (10.0 ** y)); { <--- crashes here }
y := -5.557; write('constants, y < 0 '); writeln(' x ** y = ', (10.0 ** y)); { <-- or, if you prefer, here } end.
I note that if I write 'real(10.0)' rather than '10.0', the program runs just fine...