Inicio  /  Computation  /  Vol: 9 Par: 2 (2021)  /  Artículo
ARTÍCULO
TITULO

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

Leonid V. Moroz    
Volodymyr V. Samotyy and Oleh Y. Horyachyy    

Resumen

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.

 Artículos similares

       
 
Qiang Cheng, Gun Huang, Zhiqiang Li, Jie Zheng and Qinming Liang    
The gas contained in coal plays a crucial role in triggering coal and gas outbursts. During an outburst, a large quantity of gas originally absorbed by coal is released from pulverized coal. The role this part of the gas plays in the process of coal and ... ver más
Revista: Applied Sciences

 
Minghu Wu, Chengpeng Yue, Fan Zhang, Rui Sun, Jing Tang, Sheng Hu, Nan Zhao and Juan Wang    
The state of health (SOH) and remaining useful life (RUL) of lithium-ion batteries are critical indicators for assessing battery reliability and safety management. However, these two indicators are difficult to measure directly, posing a challenge to ens... ver más
Revista: Applied Sciences

 
Jiahao Chen, Jiaxin Li, Deqian Zheng, Qianru Zheng, Jiayi Zhang, Meimei Wu and Chaosai Liu    
The multi-field coupling of grain piles in grain silos is a focal point of research in the field of grain storage. The porosity of grain piles is a critical parameter that affects the heat and moisture transfer in grain piles. To investigate the distribu... ver más
Revista: Applied Sciences

 
Ugur Ercan, Onder Kabas and Georgiana Moiceanu    
Alfalfa holds an extremely significant place in animal nutrition when it comes to providing essential nutrients. The leaves of alfalfa specifically boast the highest nutritional value, containing a remarkable 70% of crude protein and an impressive 90% of... ver más
Revista: Applied Sciences

 
Chunru Cheng, Linbing Wang, Xingye Zhou and Xudong Wang    
As the main cause of asphalt pavement distress, rutting severely affects pavement safety. Establishing an accurate rutting prediction model is crucial for asphalt pavement maintenance, pavement structure design, and pavement repair. This study explores f... ver más
Revista: Applied Sciences