Tech Off Thread

15 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

If the 286 didn't have floating point capability...

Back to Forum: Tech Off
  • User profile image
    The​Programmer

    If the 286 didn't have floating point capability, how did it handle floating point numbers? Sure there were math coprocessors, but most people didn't have it. How did those old processors handle floating point numbers?

  • User profile image
    bitmask

    My memory is a bit hazy - but the better high level language compilers at the time (Borland Turbo C, MS) provided an FPU emulation library. From a C programmer's perspective we didn't care if the machine running our software had an FPU or not - it all magically worked and took advantage of the FPU when present.

    All of the work the FPU did could be implemented in software. I'm sure you can find some floating point routines with source code for various 8/16/32 bit architectures on the web.

  • User profile image
    Manip

    TheProgrammer wrote:
    If the 286 didn't have floating point capability, how did it handle floating point numbers? Sure there were math coprocessors, but most people didn't have it. How did those old processors handle floating point numbers?


    The processor didn't, the programmer did. They broke down the problem into integer mathematics and then throw that at the CPU.

  • User profile image
    DCMonkey

    Both bitmap and Manip are right. Also remember that the 386 didn't have FP either (I remember getting a 387 coprocessor for my 386 so I could run AutoCAD. I also remember optimizing some Pascal fractal tree drawing program using 387 assembly. Fun times! *sniff*. Anyways ...). It wasn't until the 486 that Intel started integrating FP, and even then they disabled it for the budget 486sx.

  • User profile image
    RandyRants

    Correct: 
    - the 286 (and 8086/8088) didn't have a math co-pro option
    - the 386DX could get a math co-pro (the 387) while the 386SX could not. 
    - the 486DX and 486DX2 both had a math co-pro built in; the 486SX came with a socket for a 487, if you wanted a two phase buying approach.
    - the Pentium took the "math co-pro" out of the sales pitch, since it was included and no longer optional.

    Cool I remember building those boxes... it was on a 486DX EISA box that a guy asked me about needing a larger mouse pad if he got a bigger monitor.

  • User profile image
    Klaus Enevoldsen

    Although Pentium had floating point support, the first models had a flaw when calculating floating point numbers, was it the first 60,90 and 120 MhZ models? Anyway they where all replaced by Intel.

  • User profile image
    rhm

    What happened is the C library included an "FPU emulator". When FP instructions are executed on a machine with no FPU an interrupt occurs. The FPU emulator registers itself as the handler for that interrupt at startup time and so it traps those FPU instructions and emulates them with a few hundred integer instructions. It's VERY slow by comparison which is why floating point types were shunned by games programmers until the advent of the 486, and even then they were used sparingly as the 486 FPU wasn't that fast - things were much improved on the pentium. Writing 3D code without using floating point is no fun at all.

    John Carmack was one of the first to say it's OK to use fp in a tight loop with Quake 1. Even then it was only one divide per 8 pixels of the triangle rasterizer to get the perspective correction (which had been the bane of software rasterizers up to that point). It was done that way because of the asynchronous nature of the FPU - you'd execute the fp divide and the processor would carry on executing integer instructions and not wait for the result of the divide until you requested it. In the time it took to get the result of the divide it could paint the 8 pixels using the results of the previous divide. Pretty neat.

  • User profile image
    tomault

    RandyRants wrote:
    Correct: 
    - the 286 (and 8086/8088) didn't have a math co-pro option


    This isn't true.  The 8086 had a 8087 math coprocessor and the 80286 had the 80287.

  • User profile image
    rhm

    OK, if you want real old-school obscurity, does anyone else remember Weitek math co-processors? For a long time, the 80x87 wasn't the only game in town when it came to adding hardware floating point to PCs. In original IBM PC days the ISA expansion bus was really just an extension of the CPU bus, so they could make a plugin card to add the functionality. In the 286 days you had to have a special motherboard with the Weitek socket. It was a completely different architecture to the 80x87 but a lot faster. Software had to be written specially to use it so there was only any point if you used things like Autocad or wrote your own bespoke apps.

  • User profile image
    The​Programmer

    So, did software like AutoCAD back then require math co-processor to run?

  • User profile image
    Bugslayer

    rhm wrote:
    What happened is the C library included an "FPU emulator".


    Actually, the compiler supported a command-line switch to either: generate calls a floating point implemenation of IEEE fp format or emit fp instructions in-line.  When a fp instruction was executed on a system without a phyical FPU, the CPU would generate an invalid instruction exception that was caught by an OS FP emulator.

    In this way, an application would run on all systems regardless of the presence of an x87 (or IDT or Weitek FPU).  And if you added an x87 the acceleration was pretty good.  (Not that x87 acceleration was great in those days.)

  • User profile image
    rhm

    "OS FP Emulator"? Not on DOS. You linked a library, at least with the compiler I used.

  • User profile image
    DCMonkey

    TheProgrammer wrote:
    So, did software like AutoCAD back then require math co-processor to run?


    Officially it did for performance reasons. I seem to remember a TSR that probably hooked into the FP interrupt like rhm described and gave AutoCAD software emulated FP, but performance was subpar to say the least.

  • User profile image
    spoofnozzle

    If memory serves... the Maths Coprocessor was known as an "Accelerator" and simply allowed you the option to offload resources from software to firmware.

  • User profile image
    David7738

    bitmask wrote:
    My memory is a bit hazy - but the better high level language compilers at the time (Borland Turbo C, MS) provided an FPU emulation library. From a C programmer's perspective we didn't care if the machine running our software had an FPU or not - it all magically worked and took advantage of the FPU when present.

    All of the work the FPU did could be implemented in software. I'm sure you can find some floating point routines with source code for various 8/16/32 bit architectures on the web.


    XT  8086 + 8087 (math co-pro for fp)
    AT  80286 + 80287 (math co pro)
    80386 DX (32bit internal/external)
    80386 SX (32 bit internal/16 bit external) 80387 (math co-pro
    80486 DX (32 bit with copro)
    80486 SX (32 bit without copro)

    Autocad did require a x87 coprocessor (in fact it would test for it and refuse to run it not present .. cyrix did make a cheaper copro.

    Yes the borland Turbo LIbraries were nice (software or hardware floating point)


    I can remember when a dataprocessing class did something using unit record macnines and then took their dataset and ran it on the ibm/360-30 and got a different answer (off by $0.01).. Programmer either did not use BCD (binary coded decimal) or did not do a bankers round on his floating point.

    I can remember trying to code in a program to replace our HP programmable calculator and never got comparable answers (DEC PRO350) was dealing with numbers that had to be accurate to 10^-17.

    The Weitek was a better mathcopro and yes it did require a special motherboard.. also the clone(s) had the rom socket for the IBM basic ROM..

    Can still remember stores that would omit the cache ram to sell their units cheaper..

    Anyone remember what RAM price topped out at after the plastic factory burnt to the ground (all semi-conductors used the same plastic and all went up in price) .. Was it $100/Meg? Know that machines with 640K came at a premium price compared to 512K memory..

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.