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 条
  • [21] A one parameter method for the matrix inverse square root
    University of Novi Sad, Technical Faculty Mihajlo Pupin, 23000 Zrenjanin
    Applic and Math, 6 (401-410):
  • [22] Efficient Floating-Point Square Root and Reciprocal Square Root Algorithms
    Moroz, Leonid
    Samotyy, Volodymyr
    Wegrzyn, Mariusz
    Dzelendzyak, Ulyana
    PROCEEDINGS OF THE THE 11TH IEEE INTERNATIONAL CONFERENCE ON INTELLIGENT DATA ACQUISITION AND ADVANCED COMPUTING SYSTEMS: TECHNOLOGY AND APPLICATIONS (IDAACS'2021), VOL 1, 2021, : 552 - 559
  • [23] A fast integer square root
    Heinrich, P
    DR DOBBS JOURNAL, 1996, 21 (04): : 113 - &
  • [24] FAST SQUARE ROOT CONVERSION
    BRINDEL, FD
    INSTRUMENTATION TECHNOLOGY, 1968, 15 (12): : 62 - &
  • [25] Fast square-root RLS adaptive filtering algorithms
    Carini, A
    Mumolo, E
    SIGNAL PROCESSING, 1997, 57 (03) : 233 - 250
  • [26] ON THE COMPUTATION OF A MATRIX INVERSE SQUARE ROOT
    SHERIF, N
    COMPUTING, 1991, 46 (04) : 295 - 305
  • [27] Square Root Approximation to the Poisson Channel
    Tsiatmas, Anagnostis
    Willems, Frans M. J.
    Baggen, Constant P. M. J.
    2013 IEEE INTERNATIONAL SYMPOSIUM ON INFORMATION THEORY PROCEEDINGS (ISIT), 2013, : 1695 - +
  • [28] HERON'S SQUARE ROOT APPROXIMATION
    Komatsu, Takao
    JP JOURNAL OF ALGEBRA NUMBER THEORY AND APPLICATIONS, 2008, 10 (01): : 81 - 88
  • [29] Formal verification of square root algorithms
    Harrison, J
    FORMAL METHODS IN SYSTEM DESIGN, 2003, 22 (02) : 143 - 153
  • [30] Hardware architecture design and mapping of 'Fast Inverse Square Root' algorithm
    Zafar, Saad
    Adapa, Raviteja
    2014 INTERNATIONAL CONFERENCE ON ADVANCES IN ELECTRICAL ENGINEERING (ICAEE), 2014,