Is fixed point math faster than floating point?

A few years ago, in the early 1990s, I built graphical packages that optimized calculations based on fixed-point arithmetic calculations and pre-computed tables for cos, sin and scaled equations for approximating sqrt and log using Newton's approximation methods. These best practices seemed to be part of the graphics and embedded math processors. About 5 years ago, I took a numerical analysis class that touched on some of the old techniques. I have been coding for almost 30 years and rarely ever see these old fixed-point optimizers, even after working with GPGPU applications for experiments with world-class particle accelerators.Are fixed point methods still useful anywhere in the software industry, or is the utility for this knowledge forever now?

+4
source share
2 answers

Fixed point is slightly useful for platforms that do not support any decimal type; for example, I implemented a 24-bit fixed-point type for PIC16F series microcontrollers (more on why I chose a fixed-point later).

However, almost every modern processor supports floating points at the microcode or hardware level, so there is no need for a fixed point.

, , - 64- (32.32) 64- : 64- 1/(2 32), 1/(2 53); 2 31 2 2 23. , 80- .

, - , 9000000000000000000000000000000.0000000000000000000000000000000002. , , , , , .

, PIC16F , - , : 16F88 384 4095 . , ( ); shift-and-add 32- , , .

, , , . , 60% . , , , , , .

, - : 1.7E +/- 308 15 , , 64- ? , 2020 . , .

, , ( ) , , ( Doom , , , 486sx-25 1992 - Core i7, 4.0 , GeForce, 1000 , - , , - 486, i7...).

- , , , , , 80- .

+6

2 , , 3 :

  1. FPU

    DSP, MCU, FPGA . , , ... ( ).

  2. FPU

    , . , / . , . , / , . FPU:

  3. FPU ( x86) - API, . FPU , ... CPU ALU .

    , ALU FPU . , CPU/FPU ( Win32 C++):

      fcpu(0) = 3.194877 GHz // tested on first core of AMD-A8-5500 APU 3.2GHz Win7 x64 bit
    
      CPU 32bit integer aritmetics:
      add = 387.465 MIPS
      sub = 376.333 MIPS
      mul = 386.926 MIPS
      div = 245.571 MIPS
      mod = 243.869 MIPS
    
      FPU 32bit float aritmetics:
      add = 377.332 MFLOPS
      sub = 385.444 MFLOPS
      mul = 383.854 MFLOPS
      div = 367.520 MFLOPS
    
      FPU 64bit double aritmetics:
      add = 385.038 MFLOPS
      sub = 261.488 MFLOPS
      mul = 353.601 MFLOPS
      div = 309.282 MFLOPS
    

    , . , - 2 . , .

+1

All Articles