I'm having troubles catching the exception illustrated in the example
below,
instead of firing the exception when evaluating :
Value := 1 / 0;
the ' Value ' evaluates to 'Inf' which I can then report as shown with the
first MessageDlg (below), however this does not handle the exception
properly and leads to problems later on. I have been runnig this type of
exception code, without any problems, is there some kind of floating point
setup that I'm missing ?
Anyone having any suggestions ?
Claus Lynge
procedure TForm1.SpeedButton1Click(Sender: TObject);
var Value:Extended;
begin
try
Value := 1 / 0;
if FloatToStr(Value)= 'INF' then MessageDlg('Floating point div
zero!!!!', mtError,[mbOK],0);
except on EZeroDivide do
begin
MessageDlg('Floating point div zero!!!!', mtError,[mbOK],0);
end;
end;
end;
Early versions of my app don't exhibit the problem. The only thing I can
think is causing it is the program size ( >10000 lines). Is your experience
similar? If you manage to solve this could you let me know please.
tak, med venlig hilsen,
Mike
JB
Integer divide,
5 div 0; // compile time error, surprising!
Floating point constant divide,
1/0; // INF assigned to result
Floating point var divide,
v2:=0; v1/v2; // Exception triggered
JB
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
JB Manibo
http://www.cs.csubak.edu/~mmanibo
5 out of 4 people suck at fractions.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-