File Exchange

image thumbnail

Newton-Raphson reciprocal approximation , 1/x and 1/sqrt(x)

version 1.0.1 (20.2 KB) by Gert Kruger
The Newton-Raphson approximation of the reciprocal, i.e. 1/x and square root reciprocal is provided along with accuracy testing jigs.

1 Download

Updated 29 May 2019

View License

The reciprocal calculation in a real-time controller is quite computationally expensive. The Newton-Raphson approximation of the reciprocal saves on the computational cost at the expense of accuracy. If the reciprocal of an input signal is calculated, with the signal itself having a limited change from one execution cycle to the next, then the previously calculated Newton-Raphson reciprocal serves as an initial "guess" to the new the iteration. This results in a large improvement in accuracy.

The number of iterations can be modified according to the required accuracy.

An analysis can be found in:
Fowler, D. L., and James E. Smith. "An accurate, high speed implementation of division by reciprocal approximation." Proceedings of 9th Symposium on Computer Arithmetic. IEEE, 1989.

Cite As

Gert Kruger (2020). Newton-Raphson reciprocal approximation , 1/x and 1/sqrt(x) (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (1)

Nice implementation!



Removed an unnecessary variable from the reciprocal calculation which was used for performance analysis. The functions are now suitable for use (copy and paste).

MATLAB Release Compatibility
Created with R2010a
Compatible with any release
Platform Compatibility
Windows macOS Linux