FPU/math co-processor question

beer

Lifer
Jun 27, 2000
11,169
1
0
I'm taking an intro to computing class, and the way the class is taught is from the bottom-up. We've spent half the semester doing things like logic, device state, etc., and we've now moved on to machine-level programming (of a fictional computer) and soon to assembly. I had a question though. As I was doing a programming assignment, I was thinking about a paper I wrote on microprocessors about four years ago. Because I had some programming knowledge, I knew a bit about floating points and decimal operations, but I wasn't really clear on everything. Take the 486 SX/DX series; everything up to and including the 486SX didn't have floating point units. The 486DX did; yet, you could still do decimal operations on spreadsheets long before this time. My question is, since computers like the 486SX (and the LC2, our fictional computer, which only handles 2s comp integers) apparently didn't have any way to handle floating points, how did they execute decimal operations? Or am I just not clear onsomething else here?
 

Sahakiel

Golden Member
Oct 19, 2001
1,746
0
86
I'm guessing floating point was synthesized in software. Decimal operations were probably broken down into integer operations before they even got to the processor. A quick guess would be splitting the decimal number into integer and fraction, operating on them seperately, then recombining it for output.
 

Moohooya

Senior member
Oct 10, 1999
677
0
0
Floating point arithmetic is really not that hard once you have basic arithmetic operators. The 6502 and Z80 do not even have multiply or divide! First write your own integer multiply and divide routines if required using addition, subtraction and bit shifts. Then can be lots of fun if the CPU wordsize is smaller than the integer size you require, but this was all too common 20 years ago.
Next combine the integer arithmetic operators to form floating point operators. Multiply and divide are trivial.

(a*2**b) * (c*2**d) = (a*c*2**(b+d))
and
(a*2**b) / (c*2**d) = ((a/c)*2**(b-d))

As you have multiple and divide operators, a*c and a/c are trivial. So are b+d and b-d. So all you need to do is normalise the result of a*c or a/d. Remember than typically the msb is implicit in floating point format.

Addition and subtraction are a little trickier as you need to normalise first.

All other mathmetical operators can be calculated by using + / * and -. Frequently tables are used to improve performance as many functions use an itterative function to calculate the result, and the table is used to look up the initial value. (Remember the Pentium FP division bug?) For performance, some additional functions may be hardcoded. For example, calculating the square root of a number is easy in binary, and can be done with only using addition and subtraction.

I remember the days when 32 bit FP was written in hand optimised assembler using 8 bit registers. However I bet there is someone here who punched the cards for such code!
 

lukatmyshu

Senior member
Aug 22, 2001
483
1
0
If you've ever looked at the Floating Point Standard it's really interesting/complex ... it's designed in such a way so that you can perform operations relatively easily on it while only using bit operators, as well as having the nice feature of being ordered inherently. Kind of sad that the guy who designed it is FREAKIN' CRAZY. (sorry, he was one of my profs and I could not believe some of the stuff he said) ... but AFAIK it allowed CPUs to natively do those operations instead of having to break them up into other operations.
 

zephyrprime

Diamond Member
Feb 18, 2001
7,512
2
81
First, the 486SX actualled came after the 486. When the SX came out, the regular 486 was renamed the 486DX. This was all done in an effort to compete with AMD.

The answer to your question is simple. Processors without hardware FP units simply did the math using multiple integers operations. As Moohooya has said, doing so is pretty easy and I'm sure that you have to mathmatical ability to cook ups such algorithms if you ever cared t do so. This is what FP-less processors still do. On x86 platforms, the floating point emulation code that was typically used was just the code that came with C compilers. I'm sure there are probably lots of copies of such code residing on your hard drive right now. It was also possible to use third party floating point emulation packages but not many people did that.

As you can imagine, software floating point is really slow compared to hardware floating point.

Also, ever since the 8086, all x86 processors supported a floating point coprocessor. Old MBs used to have a socket for these coprocessors. FP coprocessors have gone the way of the dinosaur now.
 

zephyrprime

Diamond Member
Feb 18, 2001
7,512
2
81
First, the 486SX actualled came after the 486. When the SX came out, the regular 486 was renamed the 486DX. This was all done in an effort to compete with AMD.

The answer to your question is simple. Processors without hardware FP units simply did the math using multiple integers operations. As Moohooya has said, doing so is pretty easy and I'm sure that you have to mathmatical ability to cook ups such algorithms if you ever cared t do so. This is what FP-less processors still do. On x86 platforms, the floating point emulation code that was typically used was just the code that came with C compilers. I'm sure there are probably lots of copies of such code residing on your hard drive right now. It was also possible to use third party floating point emulation packages but not many people did that.

As you can imagine, software floating point is really slow compared to hardware floating point.

Also, ever since the 8086, all x86 processors supported a floating point coprocessor. Old MBs used to have a socket for these coprocessors. FP coprocessors have gone the way of the dinosaur now.
 

zephyrprime

Diamond Member
Feb 18, 2001
7,512
2
81
First, the 486SX actualled came after the 486. When the SX came out, the regular 486 was renamed the 486DX. This was all done in an effort to compete with AMD.

The answer to your question is simple. Processors without hardware FP units simply did the math using multiple integers operations. As Moohooya has said, doing so is pretty easy and I'm sure that you have to mathmatical ability to cook ups such algorithms if you ever cared t do so. This is what FP-less processors still do. On x86 platforms, the floating point emulation code that was typically used was just the code that came with C compilers. I'm sure there are probably lots of copies of such code residing on your hard drive right now. It was also possible to use third party floating point emulation packages but not many people did that.

As you can imagine, software floating point is really slow compared to hardware floating point.

Also, ever since the 8086, all x86 processors supported a floating point coprocessor. Old MBs used to have a socket for these coprocessors. FP coprocessors have gone the way of the dinosaur now.
 

zephyrprime

Diamond Member
Feb 18, 2001
7,512
2
81
First, the 486SX actualled came after the 486. When the SX came out, the regular 486 was renamed the 486DX. This was all done in an effort to compete with AMD.

The answer to your question is simple. Processors without hardware FP units simply did the math using multiple integers operations. As Moohooya has said, doing so is pretty easy and I'm sure that you have to mathmatical ability to cook ups such algorithms if you ever cared t do so. This is what FP-less processors still do. On x86 platforms, the floating point emulation code that was typically used was just the code that came with C compilers. I'm sure there are probably lots of copies of such code residing on your hard drive right now. It was also possible to use third party floating point emulation packages but not many people did that.

As you can imagine, software floating point is really slow compared to hardware floating point.

Also, ever since the 8086, all x86 processors supported a floating point coprocessor. Old MBs used to have a socket for these coprocessors. FP coprocessors have gone the way of the dinosaur now.
:disgust:
 
sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |