vogel@forty2.UUCP (Stefan Vogel) (05/05/88)
While experimentally determining the smallest positive number
representable on the 8087, we stepped over a problem with the 8087
"denormalized operand" exception. The following little Turbo-Pascal
program will crash in the WriteLn statement at the the expression
"r*10" when the value of r gets denormalized:
Var r : Real;
Count : Integer;
Begin
r := 1.0;
Count := 0;
While r > 0 Do Begin
r := r / 2;
Count := Succ(Count);
WriteLn(Count,' ',r,' ',r*10);
End
End.
Now the problem: If we replace the multiplication by any of the other
arithmetic operations, the program will terminate normally. Why is
this happening? Why won't the Turbo-Pascal output routines crash (the
denormalized values of r are printed!)? What is special with
multiplication? By the way, this happens in TP3 and TP4! I looked into
what I think is the initialization code for the 8087 in the TP4 run
time library. There the "denormalized operand" exception is masked
off!
Are we just stupid, or is this a real problem? Of Turbo-Pascal? Or the
8087 chip?
--
------------- UUCP:...mcvax!cernvax!forty2!vogel BITNET: K524911 at CZHRZU1A
____ _ __ Stefan Vogel
(_ |_ |_ //_|\\ | //\\ Physics Institute of University of Zuerich
_)|_ | // | \\|// \\ Switzerland