A

**floating-point unit** is a part of a

computerA computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...

system specially designed to carry out operations on

floating pointIn computing, floating point describes a method of representing real numbers in a way that can support a wide range of values. Numbers are, in general, represented approximately to a fixed number of significant digits and scaled using an exponent. The base for the scaling is normally 2, 10 or 16...

numbers. Typical operations are

additionAddition is a mathematical operation that represents combining collections of objects together into a larger collection. It is signified by the plus sign . For example, in the picture on the right, there are 3 + 2 apples—meaning three apples and two other apples—which is the same as five apples....

,

subtractionIn arithmetic, subtraction is one of the four basic binary operations; it is the inverse of addition, meaning that if we start with any number and add any number and then subtract the same number we added, we return to the number we started with...

,

multiplicationMultiplication is the mathematical operation of scaling one number by another. It is one of the four basic operations in elementary arithmetic ....

,

divisionright|thumb|200px|20 \div 4=5In mathematics, especially in elementary arithmetic, division is an arithmetic operation.Specifically, if c times b equals a, written:c \times b = a\,...

, and

square rootIn mathematics, a square root of a number x is a number r such that r2 = x, or, in other words, a number r whose square is x...

. Some systems (particularly older,

microcodeMicrocode is a layer of hardware-level instructions and/or data structures involved in the implementation of higher level machine code instructions in many computers and other processors; it resides in special high-speed memory and translates machine instructions into sequences of detailed...

-based architectures) can also perform various

transcendental functionA transcendental function is a function that does not satisfy a polynomial equation whose coefficients are themselves polynomials, in contrast to an algebraic function, which does satisfy such an equation...

s such as

exponentialIn mathematics, the exponential function is the function ex, where e is the number such that the function ex is its own derivative. The exponential function is used to model a relationship in which a constant change in the independent variable gives the same proportional change In mathematics,...

or trigonometric calculations, though in most modern processors these are done with software library routines.

In most modern general purpose

computer architectureIn computer science and engineering, computer architecture is the practical art of selecting and interconnecting hardware components to create computers that meet functional, performance and cost goals and the formal modelling of those systems....

s, one or more FPUs are integrated with the

CPUThe central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

; however many embedded processors, especially older designs, do not have hardware support for floating-point operations.

In the past, some systems have implemented floating point via a

coprocessorA coprocessor is a computer processor used to supplement the functions of the primary processor . Operations performed by the coprocessor may be floating point arithmetic, graphics, signal processing, string processing, or encryption. By offloading processor-intensive tasks from the main processor,...

rather than as an integrated unit; in the

microcomputerA microcomputer is a computer with a microprocessor as its central processing unit. They are physically small compared to mainframe and minicomputers...

era, this was generally a single

integrated circuitAn integrated circuit or monolithic integrated circuit is an electronic circuit manufactured by the patterned diffusion of trace elements into the surface of a thin substrate of semiconductor material...

, while in older systems it could be an entire

circuit boardA printed circuit board, or PCB, is used to mechanically support and electrically connect electronic components using conductive pathways, tracks or signal traces etched from copper sheets laminated onto a non-conductive substrate. It is also referred to as printed wiring board or etched wiring...

or a cabinet.

Not all computer architectures have a hardware FPU. In the absence of an FPU, many FPU functions can be emulated, which saves the added hardware cost of an FPU but is significantly slower. Emulation can be implemented on any of several levels: in the CPU as

microcodeMicrocode is a layer of hardware-level instructions and/or data structures involved in the implementation of higher level machine code instructions in many computers and other processors; it resides in special high-speed memory and translates machine instructions into sequences of detailed...

, as an

operating systemAn operating system is a set of programs that manage computer hardware resources and provide common services for application software. The operating system is the most important type of system software in a computer system...

function, or in

user spaceA conventional computer operating system usually segregates virtual memory into kernel space and user space. Kernel space is strictly reserved for running the kernel, kernel extensions, and most device drivers...

code.

In most modern computer architectures, there is some division of floating-point operations from

integerThe integers are formed by the natural numbers together with the negatives of the non-zero natural numbers .They are known as Positive and Negative Integers respectively...

operations. This division varies significantly by architecture; some, like the

Intel x86The term x86 refers to a family of instruction set architectures based on the Intel 8086 CPU. The 8086 was launched in 1978 as a fully 16-bit extension of Intel's 8-bit based 8080 microprocessor and also introduced segmentation to overcome the 16-bit addressing barrier of such designs...

have dedicated floating-point

registersIn computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...

, while some take it as far as independent clocking schemes.

Floating-point operations are often pipelined. In earlier

superscalarA superscalar CPU architecture implements a form of parallelism called instruction level parallelism within a single processor. It therefore allows faster CPU throughput than would otherwise be possible at a given clock rate...

architectures without general

out-of-order executionIn computer engineering, out-of-order execution is a paradigm used in most high-performance microprocessors to make use of instruction cycles that would otherwise be wasted by a certain type of costly delay...

, floating-point operations were sometimes pipelined separately from integer operations. Since the early and mid-1990s, many microprocessors for desktops and servers have more than one FPU.

When a CPU is executing a program that calls for a floating-point operation, there are three ways to carry it out:

- A floating-point unit emulator (a floating-point library)
- Add-on FPU
- Integrated FPU

## Floating-point library

Some floating-point hardware only supports the simplest operations—addition, subtraction, and multiplication.

But even the most complex floating-point hardware has a finite number of operations it can support—for example, none of them directly support

arbitrary-precision arithmeticIn computer science, arbitrary-precision arithmetic indicates that calculations are performed on numbers whose digits of precision are limited only by the available memory of the host system. This contrasts with the faster fixed-precision arithmetic found in most ALU hardware, which typically...

.

When a CPU is executing a program that calls for a floating-point operation not directly supported by the hardware, the CPU uses a series of simpler floating-point operations.

In systems without any floating-point hardware, the CPU emulates it using a series of simpler

fixed-point arithmeticIn computing, a fixed-point number representation is a real data type for a number that has a fixed number of digits after the radix point...

operations that run on the integer

arithmetic logic unitIn computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logical operations.The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers...

.

The software that lists the necessary series of operations to emulate floating-point operations is often packaged in a floating-point library.

## Integrated FPUs

In some cases, FPUs may be specialized, and divided between simpler floating-point operations (mainly addition and multiplication) and more complicated operations, like division. In some cases, only the simple operations may be implemented in hardware and/or

microcodeMicrocode is a layer of hardware-level instructions and/or data structures involved in the implementation of higher level machine code instructions in many computers and other processors; it resides in special high-speed memory and translates machine instructions into sequences of detailed...

, while the more complex operations are implemented as

machine codeMachine code or machine language is a system of impartible instructions executed directly by a computer's central processing unit. Each instruction performs a very specific task, typically either an operation on a unit of data Machine code or machine language is a system of impartible instructions...

routines (i.e. written in

assembly languageAn assembly language is a low-level programming language for computers, microprocessors, microcontrollers, and other programmable devices. It implements a symbolic representation of the machine codes and other constants needed to program a given CPU architecture...

or a compiled high level language).

In some current architectures, the FPU functionality is combined with units to perform

SIMDSingle instruction, multiple data , is a class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data simultaneously...

computation; an example of this is the replacement of the

x87x87 is a floating point-related subset of the x86 architecture instruction set. It originated as an extension of the 8086 instruction set in the form of optional floating point coprocessors that worked in tandem with corresponding x86 CPUs. These microchips had names ending in "87"...

instructions set with

SSEIn computing, Streaming SIMD Extensions is a SIMD instruction set extension to the x86 architecture, designed by Intel and introduced in 1999 in their Pentium III series processors as a reply to AMD's 3DNow! . SSE contains 70 new instructions, most of which work on single precision floating point...

instruction set in the

x86-64x86-64 is an extension of the x86 instruction set. It supports vastly larger virtual and physical address spaces than are possible on x86, thereby allowing programmers to conveniently work with much larger data sets. x86-64 also provides 64-bit general purpose registers and numerous other...

architecture used in newer Intel and AMD processors.

## Add-on FPUs

In the 1980s, it was common in

IBM PCThe IBM Personal Computer, commonly known as the IBM PC, is the original version and progenitor of the IBM PC compatible hardware platform. It is IBM model number 5150, and was introduced on August 12, 1981...

/compatible microcomputers for the FPU to be entirely separate from the

CPUThe central processing unit is the portion of a computer system that carries out the instructions of a computer program, to perform the basic arithmetical, logical, and input/output operations of the system. The CPU plays a role somewhat analogous to the brain in the computer. The term has been in...

, and typically sold as an optional add-on. It would only be purchased if needed to speed up or enable math-intensive programs.

The IBM PC,

XTThe IBM Personal Computer XT, often shortened to the IBM XT, PC XT, or simply XT, was IBM's successor to the original IBM PC. It was released as IBM Machine Type number 5160 on March 8, 1983, and came standard with a hard drive...

, and most compatibles based on the 8088 or 8086 had a socket for the optional 8087 coprocessor. The

ATThe IBM Personal Computer AT, more commonly known as the IBM AT and also sometimes called the PC AT or PC/AT, was IBM's second-generation PC, designed around the 6 MHz Intel 80286 microprocessor and released in 1984 as machine type 5170...

and 80286-based systems were generally socketed for the 80287, and 80386/80386SX based machines for the 80387 and 80387SX respectively, although early ones were socketed for the 80287, since the 80387 did not exist yet.

Starting with the 80486, in x86 chips the floating-point unit was integrated with the CPU, something true for almost all later x86-architecture processors. One notable exception is the 80486SX; it was also unusual in that no actual coprocessor was available – the 80487 was a full CPU with an integrated FPU; when installed, the original 80486SX would be disabled.

In addition to the Intel x87 series, several other companies manufactured co-processors for the x86 series. These included

CyrixCyrix Corporation was a microprocessor developer that was founded in 1988 in Richardson, Texas as a specialist supplier of high-performance math coprocessors for 286 and 386 microprocessors. The company was founded by former Texas Instruments staff members and had a long but troubled relationship...

which marketed its FasMath series as higher performance but fully x87 compatible, and

WeitekWeitek Corporation was a chip-design company that originally concentrated on floating point units for a number of commercial CPU designs. During the early to mid-1980s, Weitek designs could be found powering a number of high-end designs and parallel processing supercomputers...

which offered a high-performance but not fully x87 compatible series of coprocessors.

In addition to the Intel architectures, FPUs as coprocessors were available for the Motorola 68000 family line. These FPUs, the

68881 and 68882The Motorola 68881 and Motorola 68882 were floating-point coprocessor chips that were used in some computer systems in conjunction with the 68020 or 68030 CPUs. The addition of one of these chips added substantial cost to the computer, but added a floating point unit that could rapidly perform...

, were common in

Motorola 68020The Motorola 68020 is a 32-bit microprocessor from Motorola, released in 1984. It is the successor to the Motorola 68010 and is succeeded by the Motorola 68030...

/68030-based

workstationA workstation is a high-end microcomputer designed for technical or scientific applications. Intended primarily to be used by one person at a time, they are commonly connected to a local area network and run multi-user operating systems...

s like the Sun 3 series. They were also commonly added to higher-end models of Apple

MacintoshThe Macintosh , or Mac, is a series of several lines of personal computers designed, developed, and marketed by Apple Inc. The first Macintosh was introduced by Apple's then-chairman Steve Jobs on January 24, 1984; it was the first commercially successful personal computer to feature a mouse and a...

and Commodore

AmigaThe Amiga is a family of personal computers that was sold by Commodore in the 1980s and 1990s. The first model was launched in 1985 as a high-end home computer and became popular for its graphical, audio and multi-tasking abilities...

series, but unlike IBM PC-compatible systems, sockets for adding the coprocessor were not as common in lower end systems. With the

68040The Motorola 68040 is a microprocessor from Motorola, released in 1990. It is the successor to the 68030 and is followed by the 68060. There was no 68050. In keeping with general Motorola naming, the 68040 is often referred to as simply the '040 ....

, Motorola integrated the FPU and CPU, but like the x86 series, a lower cost 68LC040 without an integrated FPU was also available.

Also, there are add-on FPUs coprocessor units for

microcontrollerA microcontroller is a small computer on a single integrated circuit containing a processor core, memory, and programmable input/output peripherals. Program memory in the form of NOR flash or OTP ROM is also often included on chip, as well as a typically small amount of RAM...

units (MCUs/µCs)/

single-board computerA single-board computer is a complete computer built on a single circuit board, with microprocessor, memory, input/output and other features required of a functional computer. Unlike a typical personal computer, an SBC may not include slots into which accessory cards may be plugged...

(SBCs)' which serve to provide floating-point

arithmeticArithmetic or arithmetics is the oldest and most elementary branch of mathematics, used by almost everyone, for tasks ranging from simple day-to-day counting to advanced science and business calculations. It involves the study of quantity, especially as the result of combining numbers...

capability in systems that might not otherwise possess said functionality. The difference in these types of FPU coprocessors, when compared to more traditional floating-point coprocessors such as the 80x87 series, is that these add-on FPUs are host-processor-independent, possess their own programming requirements, and are often provided with their own

integrated development environmentAn integrated development environment is a software application that provides comprehensive facilities to computer programmers for software development...

s (IDE)s.

## See also

- ALU
In computing, an arithmetic logic unit is a digital circuit that performs arithmetic and logical operations.The ALU is a fundamental building block of the central processing unit of a computer, and even the simplest microprocessors contain one for purposes such as maintaining timers...

- Execution unit
In computer engineering, an execution unit is a part of a CPU that performs the operations and calculations called for by the Branch Unit, which receives data from the CPU...

- IEEE floating-point standard
IEEE 754–1985 was an industry standard for representingfloating-pointnumbers in computers, officially adopted in 1985 and superseded in 2008 byIEEE 754-2008. During its 23 years, it was the most widely used format for...

(also known as IEEE 754)
- IBM Floating Point Architecture
IBM System/360 computers, and subsequent machines based on that architecture , support a hexadecimal floating-point format.In comparison to IEEE 754 floating-point, the IBM floating point format has a longer significand, and a shorter exponent....