A floating point unit (FPU) is a part of a computer system specially designed to carry out operations on floating point numbers. Typical operations are addition, subtraction, multiplication, division, and square root. Some systems (particularly older, microcode-based architectures) can also perform various transcendental functions such as exponential or trigonometric calculations, though in most modern processors these are done with software library routines.
In most modern general purpose computer architectures, one or more FPUs are integrated with the CPU; 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 coprocessor rather than as an integrated unit; in the microcomputer era, this was generally a single microchip, while in older systems it could be an entire circuit board 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 microcode, as an operating system function, or in user space code.
In most modern computer architectures, there is some division of floating point operations from integer operations. This division varies significantly by architecture; some, like the Intel x86 have dedicated floating point registers, while some take it as far as independent clocking schemes.
Floating point operations are often pipelined. In earlier superscalar architectures without general out-of-order execution, floating point operations were sometimes pipelined separately from integer operations. Today, many CPUs/architectures have more than one FPU, such as the PowerPC 970, and processors based on the Netburst and AMD64 architectures (such as the Pentium 4 and Athlon 64, respectively.)
When a CPU is executing a program that calls for a floating-point operation, there are 3 ways to carry it out:
a floating point unit emulator (a floating-point library), add-on FPU and integrated FPU. Most modern computers have integrated FPU hardware.
浮點運算器(英文:floating point unit,簡稱FPU)是計算機系統的一部分,它是專門用來進行浮點數運算的。典型的運算有加減乘除和開方。一些系統(尤其是比較老的,基於微代碼體系的)還可以計算超越函式,例如指數函式或者三角函式,儘管對大多數現在的處理器,這些功能都由軟體的函式館完成。
在大多數現在的通用計算機架構中,一個或多個浮點運算器會被集成在CPU(Central Processing Unit,中央處理器)中,但許多嵌入式處理器(特別是比較老的)沒有在硬體上支持浮點數運算。
在過去,一些系統通過協同處理器而不在同一個處理器中來處理浮點數。在微型計算機時代,這一般只用一個晶片;而在以前,可能要用一整個電路板甚至一台機箱。
不是所有的計算機架構中都有硬體的浮點運算器。在沒有硬體浮點運算器的情況下,許多浮點數的運算也可以像有硬體那樣做到。這樣可以節省浮點運算器的硬體成本,但這樣會使計算變得慢得多。仿硬體浮點運算可以通過多種層次的方法實現——在CPU中用微代碼處理,用作業系統的函式處理,用用戶自己的代碼處理。
在大多數現代計算機的架構中,一些浮點數運算跟整數運算是分開的。這些分別在不同的架構上差別很大。有一些架構,例如英特爾(Intel)的x86處理器設計了浮點數暫存器,另一些架構中,處理浮點數甚至有獨立的時頻時域。
浮點數運算常常是用特別的匯流排傳輸的。在早期的沒有中斷機制的大尺度架構(的處理器)中,浮點運算有時與整數運算獨立傳輸。今時今日,許多CPU或架構都有超過一個浮點運算器,例如PowerPC 970 和基於Netburst和AMD64架構的處理器(分別例如奔騰(Pentium)4和速龍(Athlon)64)
當CPU執行一個需要浮點數運算的程式時,有三種方式可以執行:軟體仿真器(浮點運算函式館)、附加浮點運算器和集成浮點運算器。多數現在的計算機有集成的浮點運算器硬體。