# E. 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.

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?

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

          Program MyFloat;

          Uses emu387;

          var
           r: real;
          Begin
           r:=1.0;
           WriteLn(r);
          end.

`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 `DJGPP` there is no `x87` hardware, like this:

           set 387=N
           set emu387=c:/djgpp/bin/emu387.dxe

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

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

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

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.

Q: I run DJGPP in an OS/2 DOS box, and I'm told that OS/2 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 OS/2 on my machine?

A : OS/2 installs an emulator for native OS/2 images, but does not provide FPU emulation for DOS sessions.