Modified Fast Inverse Square Root and Square Root Approximation Algorithms: The Method of Switching Magic Constants

被引:10
|
作者
Moroz, Leonid V. [1 ]
Samotyy, Volodymyr V. [2 ,3 ]
Horyachyy, Oleh Y. [1 ]
机构
[1] Lviv Polytech Natl Univ, Informat Technol Secur Dept, UA-79013 Lvov, Ukraine
[2] Cracow Univ Technol, Automat & Informat Technol Dept, PL-31155 Krakow, Poland
[3] Lviv State Univ Life Safety, Informat Secur Management Dept, UA-79007 Lvov, Ukraine
关键词
elementary function approximation; fast inverse square root algorithm; IEEE; 754; standard; Newton-Raphson method; fused multiply-add; algorithm design and analysis; maximum relative error; optimization; performance evaluation; processors and microprocessors;
D O I
10.3390/computation9020021
中图分类号
O1 [数学];
学科分类号
0701 ; 070101 ;
摘要
Many low-cost platforms that support floating-point arithmetic, such as microcontrollers and field-programmable gate arrays, do not include fast hardware or software methods for calculating the square root and/or reciprocal square root. Typically, such functions are implemented using direct lookup tables or polynomial approximations, with a subsequent application of the Newton-Raphson method. Other, more complex solutions include high-radix digit-recurrence and bipartite or multipartite table-based methods. In contrast, this article proposes a simple modification of the fast inverse square root method that has high accuracy and relatively low latency. Algorithms are given in C/C++ for single- and double-precision numbers in the IEEE 754 format for both square root and reciprocal square root functions. These are based on the switching of magic constants in the initial approximation, depending on the input interval of the normalized floating-point numbers, in order to minimize the maximum relative error on each subinterval after the first iteration-giving 13 correct bits of the result. Our experimental results show that the proposed algorithms provide a fairly good trade-off between accuracy and latency after two iterations for numbers of type float, and after three iterations for numbers of type double when using fused multiply-add instructions-giving almost complete accuracy.
引用
收藏
页码:1 / 23
页数:22
相关论文
共 50 条
  • [31] SQUARE ROOT COVARIANCE LADDER ALGORITHMS
    PORAT, B
    FRIEDLANDER, B
    MORF, M
    IEEE TRANSACTIONS ON AUTOMATIC CONTROL, 1982, 27 (04) : 813 - 829
  • [32] Formal Verification of Square Root Algorithms
    John Harrison
    Formal Methods in System Design, 2003, 22 : 143 - 153
  • [33] AN ITERATIVE METHOD FOR THE COMPUTATION OF A MATRIX INVERSE-SQUARE ROOT
    LAKIC, S
    ZEITSCHRIFT FUR ANGEWANDTE MATHEMATIK UND MECHANIK, 1995, 75 (11): : 867 - 873
  • [34] Reciprocation, square root, inverse square root, and some elementary functions using small multipliers
    Ercegovac, MD
    Lang, T
    Muller, JM
    Tisserand, A
    ADVANCED SIGNAL PROCESSING ALGORITHMS, ARCHITECTURES, AND IMPLEMENTATIONS VIII, 1998, 3461 : 543 - 554
  • [35] Reciprocation, square root, inverse square root, and some elementary functions using small multipliers
    Ercegovac, MD
    Lang, T
    Muller, JM
    Tisserand, A
    IEEE TRANSACTIONS ON COMPUTERS, 2000, 49 (07) : 628 - 637
  • [36] Fast floating point square root
    Hain, TF
    Mercer, DB
    AMCS '05: Proceedings of the 2005 International Conference on Algorithmic Mathematics and Computer Science, 2005, : 33 - 39
  • [37] The Group Square-Root Lasso: Theoretical Properties and Fast Algorithms
    Bunea, Florentina
    Lederer, Johannes
    She, Yiyuan
    IEEE TRANSACTIONS ON INFORMATION THEORY, 2014, 60 (02) : 1313 - 1325
  • [38] FAST ALGORITHM COMPUTES SQUARE ROOT
    KOMUSIN, B
    EDN, 1987, 32 (24) : 250 - 252
  • [39] FAST AND STABLE ALGORITHMS FOR COMPUTING THE PRINCIPAL SQUARE ROOT OF A COMPLEX MATRIX
    SHIEH, LS
    LIAN, SR
    MCINNIS, BC
    IEEE TRANSACTIONS ON AUTOMATIC CONTROL, 1987, 32 (09) : 820 - 822
  • [40] Fast Inverse Square Root Based Matrix Inverse For MIMO-LTE Systems
    Mahapatra, Chinmaya
    Mahboob, Saad
    Leung, Victor C. M.
    Stouraitis, Thanos
    2012 INTERNATIONAL CONFERENCE ON CONTROL ENGINEERING AND COMMUNICATION TECHNOLOGY (ICCECT 2012), 2012, : 321 - 324