# Replacing Branches by Polynomials in Vectorizable Elementary Functions

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9553)

## Abstract

One of the goals for the mathematical function generator is to produce vectorizable codes. Therefore, in the generated code there should be no branching. As the most mathematical functions are implemented with domain splitting procedure and piecewise-polynomial approximation, there are several if-else statements in the final code to determine the corresponding polynomial coefficients. In this paper we propose a simple idea of replacing these if-else statements by the evaluation of a polynomial function. This is a novel approach that may not work for all the possible function implementation variants, and it needs to be improved with the use of some more sophisticated methods.

## Keywords

Mathematical functions Branching Vectorizable code Interpolation Reconstruction

## References

1. 1.
Loosemore, R.M.S.e.a.S.: The GNU C Library Reference Manual. Free Software Foundation IncGoogle Scholar
2. 2.
Kupriianova, O., Lauter, C.: Metalibm: a mathematical functions codegenerator. In: Proceedings of the 2014 Mathematical Software - ICMS 2014 - 4th International Congress, Seoul, South Korea, 5–9 August 2014, pp.713–717. http://dx.doi.org/10.1007/978-3-662-44199-2_106
3. 3.
Muller, J.-M.: Elementary Functions: Algorithms and Implementation. Birkhauser Boston Inc., Secaucus (1997)
4. 4.
Brisebarre, N., Chevillard, S.: Efficient polynomial l-approximations. In: 18th IEEE Symposium on Computer Arithmetic (ARITH-18 2007), 25–27 June 2007, Montpellier, France, pp. 169–176 (2007). http://doi.ieeecomputersociety.org/10.1109/ARITH.2007.17
5. 5.
Tang, P.T.P.: Table-driven implementation of the exponential function in IEEE floating-point arithmetic. ACM Trans. Math. Softw. 15(2), 144–157 (1989)
6. 6.
Tang, P.T.P.: Table-driven implementation of the logarithm function in IEEE floating-point arithmetic. ACM Trans. Math. Softw. 16(4), 378–400 (1990). http://acm.org/10.1145/98267.98294
7. 7.
Tang, P.T.P.: Table-driven implementation of the Expm1 function in IEEE floating-point arithmetic. ACM Trans. Math. Softw. 18(2), 211–222 (1992). http://doi.acm.org/10.1145/146847.146928
8. 8.
Kupriianova, O., Lauter, C.: A domain splitting algorithm for the mathematical functions code generator. In: Asilomar Conference on Signals, Systems and Computers, Pacific Grove, CA, USA, 2–5 November 2014 (2014, to appear)Google Scholar
9. 9.
Chevillard, S., Joldeş, M., Lauter, C.: Sollya: an environment for the development of numerical codes. In: Fukuda, K., Hoeven, J., Joswig, M., Takayama, N. (eds.) ICMS 2010. LNCS, vol. 6327, pp. 28–31. Springer, Heidelberg (2010)
10. 10.
Brunie, N., de Dinechin, F., Kupriianova, O., Lauter, C.: Code generators for mathematical functions (2014). $$<$$hal-01084726v2$$>$$Google Scholar
11. 11.
Cheney, E.W.: Introduction to Approximation Theory. AMS Chelsea Publishing, New York (1982)
12. 12.
Shary, S.P.: Solving the linear interval tolerance problem. Math. Comput. Simul. 39, 53–85 (1995)

© Springer International Publishing Switzerland 2016