# GT Pequan

# Metalibm: a code generator for parametrized mathematical functions

10/30/2014

Speaker(s) : Olga Kupriianova (PEQUAN)

The standard mathematical libraries (libm) offer a small set of elementary functions (exponential, trigonometric and others) in a small set of precisions. In scientific computing, the domains for functions may be known beforehand and the needed accuracies of the result can differ from those provided with libms. Thus, handling overflows/underflows, special inputs and computing correctly all mantissa bits may be a waste of time. We propose to provide users with the implementations adapted for their tasks. Manual implementation of each function from the libm with all possible variations (different accuracies, domains, etc.) may take hundreds of years, so we propose to move to "meta"-level and write a code generator instead (Metalibm).

Metalibm takes a set of parameters as an input and produces corresponding C code, the function to be implemented is also passed as a parameter. Thus, Metalibm can be considered as a blackbox code generator: it never knows beforehand which mathematical function it is implementing. It generates all the functions within the same scheme: argument reduction (domain splitting), polynomial approximation and reconstruction. Metalibm selects the computation parameters (e.g. precision, polynomial degrees) so, that the required final accuracy of the result is verified.

marc (at) nullmezzarobba.net