News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

CPU understands floating points

Started by thomas_remkus, January 20, 2007, 11:45:18 PM

Previous topic - Next topic

thomas_remkus

I thought that the CPU did not understand floating points but I read there is a FWORD and QWORD and these seem to be floaters just fine. There are also CPU operands that are available for floats. Am I nuts, does this really exist? I thought the CPU knew nothing for the float.

BogdanOntanu

Some CPU's do know floating point numbers and some do not.

Intel CPU's and compatibles starting from 486 DX upwards can handle the floating point numbers and operations internally by a hardware subsystem called the FPU (Floating point Unit)

So yes x86 "new" architecture is able to handle floating point operations.

Z80 does not :D
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

raymond

In the context of BogdanOntanu's answer, the CPU would also have a second subsystem generally referred to as the ALU which would handle the integer operations. Instructions are sent to the appropriate subsystem by the managing part of the CPU. Those two subsystems may share some common "hardware" such as for performing multiplications.

One semantic problem has been that the ALU subsystem is very often called the CPU based on the original chips which did not have the FPU integrated on it.

However, to answer Thomas, some "integer" operations can be performed on floats with the ALU IF you know what you are doing.

Raymond
When you assume something, you risk being wrong half the time
http://www.ray.masmcode.com

GregL

Just to add to what has been said.

Regarding Intel CPUs:

The 8088, 8086, 80286, 30386 and 80486SX required a separate 80x87 FPU chip to do floating point. There was also 80x87 emulation software, but it was really slow.

The 80486DX and all later CPUs have the FPU built-in, on the same chip.

I remember, in the mid '80s, getting and installing a separate 8087 chip, what a thrill that was, fast floating point.  :bg

I used MASM back then too. It was fun then, it's still fun now.








MichaelW

And to add more, the emulation software was at one time a common component for high-level languages. For an idea of how much slower the emulators were than the FPU, this loop:

FOR i& = 1 TO 1000000
    pi# = 4 * (4 * ATN(1 / 5) - ATN(1 / 239))
NEXT

Compiled with Microsoft PDS 7.0, and running on a P3-500, will execute in about 1.5 seconds when compiled to use the FPU, and in about 7.2 seconds when compiled to use the emulator.

QuoteI remember, in the mid '80s, getting and installing a separate 8087 chip, what a thrill that was, fast floating point.

Not to mention the thrill of trying to plug a ~$1000 chip (a 25MHz 80387 IIRC) into a non-ZIF PGA socket.
eschew obfuscation

GregL

Quote from: MichaelWNot to mention the thrill of trying to plug a ~$1000 chip (a 25MHz 80387 IIRC) into a non-ZIF PGA socket.

Yeah, that was a thrill too.


thomas_remkus,

Raymond wrote an excellent FPU tutorial, here's a link to it: Simply FPU