home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
pascal
/
library
/
windows
/
win87emu
/
testfp.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-03-29
|
1KB
|
58 lines
{$N+,E+}
{$M 8100}
{$IFNDEF DPMI}
!! Error: this is a DOS Protected mode program
{$ENDIF}
{.$DEFINE BADDAPP}
{ To demostrate the error message displayed when the emulator code
is not present, define the symbol BADAPP. When defined the
procedure LinkInEmulator will be ignored causing the compiler
to omit the emulator code from the EXE }
uses CRT,FPDLL;
var
d : integer;
ErrorOccured : boolean;
Function LFunc(x : integer) : integer;
{ This procedure is functionally the same as FPFunc
except that FPFunc uses floating point variables and math }
var
a,b : longint;
begin
a := (x*10)+15;
b := a*2;
LFunc := (a*b) div 100;
end;
{$IFNDEF BADAPP}
Procedure LinkInEmulator;
var
d : double;
begin
d := 1.5;
end;
{$ENDIF}
begin
ErrorOccured := false;
Writeln('Testing Arithmetic functions ...');
for d := 0 to 2000 do
if FPFunc(d) <> LFunc(d) then
begin
ErrorOccured := true;
Writeln('BAD: ',d);
end;
if not ErrorOccured then Writeln('No errors detected');
Writeln('Testing Sqrt function ...');
for d := 0 to 100 do
if SqrtFunc(d*d) <> d then
begin
ErrorOccured := true;
Writeln('BAD: ',d);
end;
if not ErrorOccured then Writeln('No errors detected');
end.