Efficient evaluation methods of elementary functions suitable for SIMD computation

  • Naoki ShibataEmail author
Special Issue Paper


Data-parallel architectures like SIMD (Single Instruction Multiple Data) or SIMT (Single Instruction Multiple Thread) have been adopted in many recent CPU and GPU architectures. Although some SIMD and SIMT instruction sets include double-precision arithmetic and bitwise operations, there are no instructions dedicated to evaluating elementary functions like trigonometric functions in double precision. Thus, these functions have to be evaluated one by one using an FPU or using a software library. However, traditional algorithms for evaluating these elementary functions involve heavy use of conditional branches and/or table look-ups, which are not suitable for SIMD computation. In this paper, efficient methods are proposed for evaluating the sine, cosine, arc tangent, exponential and logarithmic functions in double precision without table look-ups, scattering from, or gathering into SIMD registers, or conditional branches. We implemented these methods using the Intel SSE2 instruction set to evaluate their accuracy and speed. The results showed that the average error was less than 0.67 ulp, and the maximum error was 6 ulps. The computation speed was faster than the FPUs on Intel Core 2 and Core i7 processors.


SIMD Elementary functions 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Seiler L, Carmean D, Sprangle E, Forsyth T, Abrash M, Dubey P, Junkins S, Lake A, Sugerman J, Cavin R, Espasa R, Grochowski E, Juan T, Hanrahan P (2008) Larrabee: a many-core x86 architecture for visual computing. In: Proceedings of ACM SIGGRAPH 2008, pp 1–15 Google Scholar
  2. 2.
    Barker K, Davis K, Hoisie A, Kerbyson D, Lang M, Pakin S, Sancho J (2008) Entering the petaflop era: the architecture and performance of Roadrunner. In: Proceedings of the 2008 ACM/IEEE conference on supercomputing, pp 1–11 Google Scholar
  3. 3.
    Gschwind M, Hofstee H, Flachs B, Hopkins M, Watanabe Y, Yamazaki T (2006) Synergistic processing in cell’s multicore architecture. IEEE MICRO 26(2):10–24 CrossRefGoogle Scholar
  4. 4.
    Tesla C2050 and Tesla C2070 Computing Processor Board.
  5. 5.
    Thakkar S, Huff T (1999) Internet streaming SIMD extensions. Computer 32(12):26–34 CrossRefGoogle Scholar
  6. 6.
  7. 7.
    Simple SSE SSE2 optimized sin, cos, log and exp.
  8. 8.
    Nyland L, Snyder M Fast trigonometric functions using Intel’s SSE2 instructions. Tech Report Google Scholar
  9. 9.
    Linux Kernel Version
  10. 10.
    GNU C Library Version 2.7.
  11. 11.
    Brent R (2006) Fast algorithms for high-precision computation of elementary functions. In: Proceedings of 7th conference on real numbers and computers (RNC 7), pp 7–8 Google Scholar
  12. 12.
    The MPFR Library.
  13. 13.
    Detrey J, Dinechin F, Pujul X (2007) Return of the hardware floating-point elementary function. In: Proceedings of the 18th IEEE symposium on computer arithmetic, pp 161–168 Google Scholar
  14. 14.
    Koren I, Zinaty O (1990) Evaluating elementary functions in a numerical coprocessor based on rational approximations. IEEE Trans Comput 39(8):1030–1037 CrossRefGoogle Scholar
  15. 15.
    Ercegovac M, Lang T, Muller J, Tisserand A (2000) Reciprocation, square root, inverse square root, and some elementary functions using small multipliers. IEEE Trans Comput 49(7):628–637 CrossRefMathSciNetGoogle Scholar
  16. 16.
    Goto E, Wong WF (1995) Fast evaluation of the elementary functions in single precision. IEEE Trans Comput 44(3):453–457 zbMATHCrossRefGoogle Scholar
  17. 17.
    Scarpazza D, Russell G (2009) High-performance regular expression scanning on the Cell/B.E. processor. In: Proceedings of the 23rd international conference on supercomputing, pp 14–25 Google Scholar
  18. 18.
    Rehman M, Kothapalli K, Narayanan P (2009) Fast and scalable list ranking on the GPU. In: Proceedings of the 23rd international conference on supercomputing, pp 235–243 Google Scholar
  19. 19.
    Goldberg D (1991) What every computer scientist should know about floating-point arithmetic. ACM Comput Surv 23(1):5–48 CrossRefGoogle Scholar
  20. 20.
    Abramowitz M, Stegun I (1965) Handbook of mathematical functions: with formulas, graphs, and mathematical tables. Dover, New York Google Scholar

Copyright information

© Springer-Verlag 2010

Authors and Affiliations

  1. 1.Department of Information Processing & ManagementShiga UniversityHikoneJapan

Personalised recommendations