summaryrefslogtreecommitdiff
path: root/fpcdocs/float.tex
blob: cfd037cee9f0f26fa25cc67c298b5074ad3eb89b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
\chapter{The Floating Point Coprocessor emulator}

In this appendix we note some caveats when using the floating point
emulator on GO32V2 systems. Under GO32V1 systems, all is as described in
the installation section.

{\em Q: I don't have an 80387. How do I compile and run floating point
   programs under GO32V2?

     Q: What shall I install on a target machine which lacks hardware
   floating-point support?
}

{\em A :}
 Programs which use floating point computations and could be run on
   machines without an 80387 should be allowed to dynamically load the
\file{emu387.dxe}
   file at run-time if needed. To do this you must link the \var{emu387} unit to your
   exectuable program, for example:

\begin{verbatim}
      Program MyFloat;

      Uses emu387;

      var
       r: real;
      Begin
       r:=1.0;
       WriteLn(r);
      end.
\end{verbatim}

   \var{Emu387} takes care of loading the dynamic emulation point library.

   You should always add emulation when you distribute floating-point
   programs.

   A few users reported that the emulation won't work for them unless
   they explicitly tell \var{DJGPP} there is no \var{x87} hardware, like this:

\begin{verbatim}
       set 387=N
       set emu387=c:/djgpp/bin/emu387.dxe
\end{verbatim}

   There is an alternative FP emulator called WMEMU. It mimics a real
   coprocessor more closely.

   {\em WARNING:} We strongly suggest that you use WMEMU as FPU emulator, since
   \file{emu387.dxe} does not emulate all the instructions which are used by the
   Run-Time Libary such as \var{FWAIT}.


{\em   Q: I have an 80387 emulator installed in my AUTOEXEC.BAT, but
   DJGPP-compiled floating point programs still doesn't work. Why?
}


{\em   A :} DJGPP switches the CPU to protected mode, and the information
   needed to emulate the 80387 is different. Not to mention that the
   exceptions never get to the real-mode handler. You must use emulators
   which are designed for DJGPP. Apart of emu387 and WMEMU, the only
   other emulator known to work with DJGPP is Q87 from QuickWare. Q87 is
   shareware and is available from the QuickWare Web site.


{\em   Q: I run DJGPP in an \ostwo DOS box, and I'm told that \ostwo will install
   its own emulator library if the CPU has no FPU, and will transparently
   execute FPU instructions. So why won't DJGPP run floating-point code
   under \ostwo on my machine?
}

{\em   A} : \ostwo installs an emulator for native \ostwo images, but does not
   provide FPU emulation for DOS sessions.