open-watcom/open-watcom-v2 — pull request #18 by ArmstrongJ (2013-11-14 13:40:48+00:00)
Title: Initial Implementation of C99 Math Functions

This pull request includes the double-precision implementations and documentation of missing C99 math functions for inclusion in Open Watcom. The code for the functions is based on a number of sources, including FDLIBM, SPECFUN, and SLATEC packages, as well as some custom routines (notably expm1() and most of the rounding-related functions).

In addition to the C99 functions, two extensions functions, lgamma_r() and erfc() have been included. The former is commonly found in other C runtimes, so it is beneficial for OW to include it as well. The latter is simple to compute using the SPECFUN-derived routine anyway, so there is probably no harm in including it.

The math test suite was updated to actually compile (via "builder tests" command). The suite was extended to provide basic testing of the new routines since many of them are non-trivial. Compiling the test suite for small and compact memory models on appropriate platforms has been disabled as the test program no longer fits in 64k. However, the test suite does execute successfully in larger models on those platforms, so I wouldn't be concerned about the correctness of the library.

Documentation for the routines has been included, but I won't promise superior quality of the included write-ups.

C99 does require some exception throwing in a few of these new functions. Exceptions have not yet been implemented in this code. That probably should be considered an enhancement after this is accepted (if it is accepted).

I think the assortment of sources for the routines, notably SPECFUN and SLATEC, are advantageous to Open Watcom. Other C runtimes I glanced at (BSD, musl, GNU) were using code from FDLIBM exclusively. Open Watcom will now provide some functions sourced from alternative packages which helps to ensure a bit of diversity in the C runtime math library ecosystem.