home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / windows / win87emu / testfp.pas < prev    next >
Pascal/Delphi Source File  |  1993-03-29  |  1KB  |  58 lines

  1. {$N+,E+}
  2. {$M 8100}
  3. {$IFNDEF DPMI}
  4.   !! Error: this is a DOS Protected mode program
  5. {$ENDIF}
  6.  
  7. {.$DEFINE BADDAPP}
  8. { To demostrate the error message displayed when the emulator code
  9.   is not present, define the symbol BADAPP.  When defined the
  10.   procedure LinkInEmulator will be ignored causing the compiler
  11.   to omit the emulator code from the EXE }
  12.  
  13. uses CRT,FPDLL;
  14.  
  15. var
  16.   d : integer;
  17.   ErrorOccured : boolean;
  18.  
  19. Function LFunc(x : integer) : integer;
  20. { This procedure is functionally the same as FPFunc
  21.   except that FPFunc uses floating point variables and math }
  22. var
  23.   a,b : longint;
  24. begin
  25.   a := (x*10)+15;
  26.   b := a*2;
  27.   LFunc := (a*b) div 100;
  28. end;
  29.  
  30. {$IFNDEF BADAPP}
  31. Procedure LinkInEmulator;
  32. var
  33.   d : double;
  34. begin
  35.   d := 1.5;
  36. end;
  37. {$ENDIF}
  38.  
  39. begin
  40.   ErrorOccured := false;
  41.   Writeln('Testing Arithmetic functions ...');
  42.   for d := 0 to 2000 do
  43.     if FPFunc(d) <> LFunc(d) then
  44.        begin
  45.        ErrorOccured := true;
  46.        Writeln('BAD: ',d);
  47.        end;
  48.   if not ErrorOccured then Writeln('No errors detected');
  49.   Writeln('Testing Sqrt function ...');
  50.   for d := 0 to 100 do
  51.     if SqrtFunc(d*d) <> d then
  52.        begin
  53.        ErrorOccured := true;
  54.        Writeln('BAD: ',d);
  55.        end;
  56.   if not ErrorOccured then Writeln('No errors detected');
  57. end.
  58.