Index: src/libcfa/math.c
===================================================================
--- src/libcfa/math.c	(revision 6e991d61d3d430d19f91624ec57c3454edee668a)
+++ src/libcfa/math.c	(revision dc5376a15ff2e64a5f2ea5042812b95f826a9656)
@@ -1,3 +1,2 @@
-//                               -*- Mode: C -*- 
 // 
 // Cforall Version 1.0.0 Copyright (C) 2016 University of Waterloo
@@ -11,16 +10,121 @@
 // Created On       : Tue Apr 19 22:23:08 2016
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Apr 21 07:56:49 2016
-// Update Count     : 51
+// Last Modified On : Sun Apr 24 08:52:31 2016
+// Update Count     : 75
 // 
 
 #include "math"
 
-//---------------------------------------
-
 extern "C" {
-#include <math.h>
 #include <complex.h>
 } // extern "C"
+
+float fabs( float x ) { return fabsf( x ); }
+long double fabs( long double x ) { return fabsl( x ); }
+float cabs( float _Complex x ) { return cabsf( x ); }
+double cabs( double _Complex x ) { return cabs( x ); }
+long double cabs( long double _Complex x ) { return cabsl( x ); }
+
+float ?%?( float x, float y ) { return fmodf( x, y ); }
+float fmod( float x, float y ) { return fmodf( x, y ); }
+double ?%?( double x, double y ) { return fmod( x, y ); }
+long double ?%?( long double x, long double y ) { return fmodl( x, y ); }
+long double fmod( long double x, long double y ) { return fmodl( x, y ); }
+
+float remainder( float x, float y ) { return remainderf( x, y ); }
+long double remainder( long double x, long double y ) { return remainderl( x, y ); }
+
+// [ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
+float remquo( float x, float y, int *quo ) { return remquof( x, y, quo ); }
+// [ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
+// [ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
+long double remquo( long double x, long double y, int *quo ) { return remquol( x, y, quo ); }
+
+// [ int, float ] div( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
+float div( float x, float y, int *quo ) { return remquof( x, y, quo ); }
+// [ int, double ] div( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
+// [ int, long double ] div( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
+long double div( long double x, long double y, int *quo ) { return remquol( x, y, quo ); }
+
+float fma( float x, float y, float z ) { return fmaf( x, y, z ); }
+long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); }
+
+float fdim( float x, float y ) { return fdimf( x, y ); }
+long double fdim( long double x, long double y ) { return fdiml( x, y ); }
+
+float nan( const char *tag ) { return nanf( tag ); }
+long double nan( const char *tag ) { return nanl( tag ); }
+
+//---------------------- Exponential ----------------------
+
+float exp( float x ) { return expf( x ); }
+long double exp( long double x ) { return expl( x ); }
+float _Complex exp( float _Complex x ) { return cexpf( x ); }
+double _Complex exp( double _Complex x ) { return cexp( x ); }
+long double _Complex exp( long double _Complex x ) { return cexpl( x ); }
+
+float exp2( float x ) { return exp2f( x ); }
+long double exp2( long double x ) { return exp2l( x ); }
+// float _Complex exp2( float _Complex x ) { return cexp2f( x ); }
+// double _Complex exp2( double _Complex x ) { return cexp2( x ); }
+// long double _Complex exp2( long double _Complex x ) { return cexp2l( x ); }
+
+float expm1( float x ) { return expm1f( x ); }
+long double expm1( long double x ) { return expm1l( x ); }
+
+float log( float x ) { return logf( x ); }
+long double log( long double x ) { return logl( x ); }
+float _Complex log( float _Complex x ) { return clogf( x ); }
+double _Complex log( double _Complex x ) { return clog( x ); }
+long double _Complex log( long double _Complex x ) { return clogl( x ); }
+
+float log2( float x ) { return log2f( x ); }
+long double log2( long double x ) { return log2l( x ); }
+// float _Complex log2( float _Complex x ) { return clog2f( x ); }
+// double _Complex log2( double _Complex x ) { return clog2( x ); }
+// long double _Complex log2( long double _Complex x ) { return clog2l( x ); }
+
+float log10( float x ) { return log10f( x ); }
+long double log10( long double x ) { return log10l( x ); }
+// float _Complex log10( float _Complex x ) { return clog10f( x ); }
+// double _Complex log10( double _Complex x ) { return clog10( x ); }
+// long double _Complex log10( long double _Complex x ) { return clog10l( x ); }
+
+float log1p( float x ) { return log1pf( x ); }
+long double log1p( long double x ) { return log1pl( x ); }
+
+int ilogb( float x ) { return ilogbf( x ); }
+int ilogb( long double x ) { return ilogbl( x ); }
+
+float logb( float x ) { return logbf( x ); }
+long double logb( long double x ) { return logbl( x ); }
+
+//---------------------- Power ----------------------
+
+float sqrt( float x ) { return sqrtf( x ); }
+long double sqrt( long double x ) { return sqrtl( x ); }
+float _Complex sqrt( float _Complex x ) { return csqrtf( x ); }
+double _Complex sqrt( double _Complex x ) { return csqrt( x ); }
+long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); }
+
+float cbrt( float x ) { return cbrtf( x ); }
+long double cbrt( long double x ) { return cbrtl( x ); }
+
+float hypot( float x, float y ) { return hypotf( x, y ); }
+long double hypot( long double x, long double y ) { return hypotl( x, y ); }
+
+float pow( float x, float y ) { return powf( x, y ); }
+long double pow( long double x, long double y ) { return powl( x, y ); }
+float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); }
+double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); }
+long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); }
+
+//---------------------- Trigonometric ----------------------
+
+float sin( float x ) { return sinf( x ); }
+long double sin( long double x ) { return sinl( x ); }
+float _Complex sin( float _Complex x ) { return csinf( x ); }
+double _Complex sin( double _Complex x ) { return csin( x ); }
+long double _Complex sin( long double _Complex x ) { return csinl( x ); }
 
 float cos( float x ) { return cosf( x ); }
@@ -30,4 +134,44 @@
 long double _Complex cos( long double _Complex x ) { return ccosl( x ); }
 
+float tan( float x ) { return tanf( x ); }
+long double tan( long double x ) { return tanl( x ); }
+float _Complex tan( float _Complex x ) { return ctanf( x ); }
+double _Complex tan( double _Complex x ) { return ctan( x ); }
+long double _Complex tan( long double _Complex x ) { return ctanl( x ); }
+
+float asin( float x ) { return asinf( x ); }
+long double asin( long double x ) { return asinl( x ); }
+float _Complex asin( float _Complex x ) { return casinf( x ); }
+double _Complex asin( double _Complex x ) { return casin( x ); }
+long double _Complex asin( long double _Complex x ) { return casinl( x ); }
+
+float acos( float x ) { return acosf( x ); }
+long double acos( long double x ) { return acosl( x ); }
+float _Complex acos( float _Complex x ) { return cacosf( x ); }
+double _Complex acos( double _Complex x ) { return cacos( x ); }
+long double _Complex acos( long double _Complex x ) { return cacosl( x ); }
+
+float atan( float x ) { return atanf( x ); }
+long double atan( long double x ) { return atanl( x ); }
+float _Complex atan( float _Complex x ) { return catanf( x ); }
+double _Complex atan( double _Complex x ) { return catan( x ); }
+long double _Complex atan( long double _Complex x ) { return catanl( x ); }
+
+float atan2( float x, float y ) { return atan2f( x, y ); }
+double atan2( double x, double y ) { return atan2( x, y ); }
+long double atan2( long double x, long double y ) { return atan2l( x, y ); }
+
+float atan( float x, float y ) { return atan2f( x, y ); }
+double atan( double x, double y ) { return atan2( x, y ); }
+long double atan( long double x, long double y ) { return atan2l( x, y ); }
+
+//---------------------- Hyperbolic ----------------------
+
+float sinh( float x ) { return sinhf( x ); }
+long double sinh( long double x ) { return sinhl( x ); }
+float _Complex sinh( float _Complex x ) { return csinhf( x ); }
+double _Complex sinh( double _Complex x ) { return csinh( x ); }
+long double _Complex sinh( long double _Complex x ) { return csinhl( x ); }
+
 float cosh( float x ) { return coshf( x ); }
 long double cosh( long double x ) { return coshl( x ); }
@@ -36,9 +180,15 @@
 long double _Complex cosh( long double _Complex x ) { return ccoshl( x ); }
 
-float acos( float x ) { return acosf( x ); }
-long double acos( long double x ) { return acosl( x ); }
-float _Complex acos( float _Complex x ) { return cacosf( x ); }
-double _Complex acos( double _Complex x ) { return cacos( x ); }
-long double _Complex acos( long double _Complex x ) { return cacosl( x ); }
+float tanh( float x ) { return tanhf( x ); }
+long double tanh( long double x ) { return tanhl( x ); }
+float _Complex tanh( float _Complex x ) { return ctanhf( x ); }
+double _Complex tanh( double _Complex x ) { return ctanh( x ); }
+long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); }
+
+float asinh( float x ) { return asinhf( x ); }
+long double asinh( long double x ) { return asinhl( x ); }
+float _Complex asinh( float _Complex x ) { return casinhf( x ); }
+double _Complex asinh( double _Complex x ) { return casinh( x ); }
+long double _Complex asinh( long double _Complex x ) { return casinhl( x ); }
 
 float acosh( float x ) { return acoshf( x ); }
@@ -48,50 +198,4 @@
 long double _Complex acosh( long double _Complex x ) { return cacoshl( x ); }
 
-float sin( float x ) { return sinf( x ); }
-long double sin( long double x ) { return sinl( x ); }
-float _Complex sin( float _Complex x ) { return csinf( x ); }
-double _Complex sin( double _Complex x ) { return csin( x ); }
-long double _Complex sin( long double _Complex x ) { return csinl( x ); }
-
-float sinh( float x ) { return sinhf( x ); }
-long double sinh( long double x ) { return sinhl( x ); }
-float _Complex sinh( float _Complex x ) { return csinhf( x ); }
-double _Complex sinh( double _Complex x ) { return csinh( x ); }
-long double _Complex sinh( long double _Complex x ) { return csinhl( x ); }
-
-float asin( float x ) { return asinf( x ); }
-long double asin( long double x ) { return asinl( x ); }
-float _Complex asin( float _Complex x ) { return casinf( x ); }
-double _Complex asin( double _Complex x ) { return casin( x ); }
-long double _Complex asin( long double _Complex x ) { return casinl( x ); }
-
-float asinh( float x ) { return asinhf( x ); }
-long double asinh( long double x ) { return asinhl( x ); }
-float _Complex asinh( float _Complex x ) { return casinhf( x ); }
-double _Complex asinh( double _Complex x ) { return casinh( x ); }
-long double _Complex asinh( long double _Complex x ) { return casinhl( x ); }
-
-float tan( float x ) { return tanf( x ); }
-long double tan( long double x ) { return tanl( x ); }
-float _Complex tan( float _Complex x ) { return ctanf( x ); }
-double _Complex tan( double _Complex x ) { return ctan( x ); }
-long double _Complex tan( long double _Complex x ) { return ctanl( x ); }
-
-float tanh( float x ) { return tanhf( x ); }
-long double tanh( long double x ) { return tanhl( x ); }
-float _Complex tanh( float _Complex x ) { return ctanhf( x ); }
-double _Complex tanh( double _Complex x ) { return ctanh( x ); }
-long double _Complex tanh( long double _Complex x ) { return ctanhl( x ); }
-
-float atan( float x ) { return atanf( x ); }
-long double atan( long double x ) { return atanl( x ); }
-float _Complex atan( float _Complex x ) { return catanf( x ); }
-double _Complex atan( double _Complex x ) { return catan( x ); }
-long double _Complex atan( long double _Complex x ) { return catanl( x ); }
-
-float atan( float x, float y ) { return atan2f( x, y ); }
-double atan( double x, double y ) { return atan2( x, y ); }
-long double atan( long double x, long double y ) { return atan2l( x, y ); }
-
 float atanh( float x ) { return atanhf( x ); }
 long double atanh( long double x ) { return atanhl( x ); }
@@ -100,32 +204,28 @@
 long double _Complex atanh( long double _Complex x ) { return catanhl( x ); }
 
-float exp( float x ) { return expf( x ); }
-long double exp( long double x ) { return expl( x ); }
-float _Complex exp( float _Complex x ) { return cexpf( x ); }
-double _Complex exp( double _Complex x ) { return cexp( x ); }
-long double _Complex exp( long double _Complex x ) { return cexpl( x ); }
-
-float log( float x ) { return logf( x ); }
-long double log( long double x ) { return logl( x ); }
-float _Complex log( float _Complex x ) { return clogf( x ); }
-double _Complex log( double _Complex x ) { return clog( x ); }
-long double _Complex log( long double _Complex x ) { return clogl( x ); }
-
-float pow( float x, float y ) { return powf( x, y ); }
-long double pow( long double x, long double y ) { return powl( x, y ); }
-float _Complex pow( float _Complex x, float _Complex y ) { return cpowf( x, y ); }
-double _Complex pow( double _Complex x, double _Complex y ) { return cpow( x, y ); }
-long double _Complex pow( long double _Complex x, long double _Complex y ) { return cpowl( x, y ); }
-
-float sqrt( float x ) { return sqrtf( x ); }
-long double sqrt( long double x ) { return sqrtl( x ); }
-float _Complex sqrt( float _Complex x ) { return csqrtf( x ); }
-double _Complex sqrt( double _Complex x ) { return csqrt( x ); }
-long double _Complex sqrt( long double _Complex x ) { return csqrtl( x ); }
-
-float fabs( float x ) { return fabsf( x ); }
-long double fabs( long double x ) { return fabsl( x ); }
-float cabs( float _Complex x ) { return cabsf( x ); }
-long double cabs( long double _Complex x ) { return cabsl( x ); }
+//---------------------- Error / Gamma ----------------------
+
+float erf( float x ) { return erff( x ); }
+long double erf( long double x ) { return erfl( x ); }
+// float _Complex erf( float _Complex x ) { return crflf( x ); }
+// double _Complex erf( double _Complex x ) { return crfl( x ); }
+// long double _Complex erf( long double _Complex x ) { return crfll( x ); }
+
+float erfc( float x ) { return erfcf( x ); }
+long double erfc( long double x ) { return erfcl( x ); }
+// float _Complex erfc( float _Complex x ) { return cerfcf( x ); }
+// double _Complex erfc( double _Complex x ) { return cerfc( x ); }
+// long double _Complex erfc( long double _Complex x ) { return cerfcl( x ); }
+
+float lgamma( float x ) { return lgammaf( x ); }
+long double lgamma( long double x ) { return lgammal( x ); }
+float lgamma( float x, int *sign ) { return lgammaf_r( x, sign ); }
+double lgamma( double x, int *sign ) { return lgamma_r( x, sign ); }
+long double lgamma( long double x, int *sign ) { return lgammal_r( x, sign ); }
+
+float tgamma( float x ) { return tgammaf( x ); }
+long double tgamma( long double x ) { return tgammal( x ); }
+
+//---------------------- Nearest Integer ----------------------
 
 float floor( float x ) { return floorf( x ); }
@@ -135,53 +235,6 @@
 long double ceil( long double x ) { return ceill( x ); }
 
-//---------------------------------------
-
-float cbrt( float x ) { return cbrtf( x ); }
-long double cbrt( long double x ) { return cbrtl( x ); }
-
-float copysign( float x, float y ) { return copysignf( x, y ); }
-long double copysign( long double x, long double y ) { return copysignl( x, y ); }
-
-float erf( float x ) { return erff( x ); }
-long double erf( long double x ) { return erfl( x ); }
-
-float erfc( float x ) { return erfcf( x ); }
-long double erfc( long double x ) { return erfcl( x ); }
-
-float exp2( float x ) { return exp2f( x ); }
-long double exp2( long double x ) { return exp2l( x ); }
-
-float expm1( float x ) { return expm1f( x ); }
-long double expm1( long double x ) { return expm1l( x ); }
-
-float fdim( float x, float y ) { return fdimf( x, y ); }
-long double fdim( long double x, long double y ) { return fdiml( x, y ); }
-
-float fma( float x, float y, float z ) { return fmaf( x, y, z ); }
-long double fma( long double x, long double y, long double z ) { return fmal( x, y, z ); }
-
-float ?%?( float x, float y ) { return fmodf( x, y ); }
-float fmod( float x, float y ) { return fmodf( x, y ); }
-double ?%?( double x, double y ) { return fmod( x, y ); }
-long double ?%?( long double x, long double y ) { return fmodl( x, y ); }
-long double fmod( long double x, long double y ) { return fmodl( x, y ); }
-
-//[ int, float ] div( float x ) { int i; x = frexpf( x, &i ); return [ i, x ]; }
-float frexp( float x, int *ip ) { return frexpf( x, ip ); }
-//[ int, double ] div( double x ) { int i; x = frexp( x, &i ); return [ i, x ]; }
-//[ int, long double ] div( long double x ) { int i; x = frexpl( x, &i ); return [ i, x ]; }
-long double frexp( long double x, int *ip ) { return frexpl( x, ip ); }
-
-float hypot( float x, float y ) { return hypotf( x, y ); }
-long double hypot( long double x, long double y ) { return hypotl( x, y ); }
-
-int ilogb( float x ) { return ilogbf( x ); }
-int ilogb( long double x ) { return ilogbl( x ); }
-
-float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); }
-long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
-
-float lgamma( float x ) { return lgammaf( x ); }
-long double lgamma( long double x ) { return lgammal( x ); }
+float trunc( float x ) { return truncf( x ); }
+long double trunc( long double x ) { return truncl( x ); }
 
 float rint( float x ) { return rintf( x ); }
@@ -199,4 +252,7 @@
 long long int llrint( long double x ) { return llrintl( x ); }
 
+float nearbyint( float x ) { return nearbyintf( x ); }
+long double nearbyint( long double x ) { return nearbyintl( x ); }
+
 float round( float x ) { return roundf( x ); }
 long double round( long double x ) { return roundl( x ); }
@@ -213,18 +269,20 @@
 long long int llround( long double x ) { return llroundl( x ); }
 
-float log10( float x ) { return log10f( x ); }
-long double log10( long double x ) { return log10l( x ); }
-
-float log1p( float x ) { return log1pf( x ); }
-long double log1p( long double x ) { return log1pl( x ); }
-
-float log2( float x ) { return log2f( x ); }
-long double log2( long double x ) { return log2l( x ); }
-
-float logb( float x ) { return logbf( x ); }
-long double logb( long double x ) { return logbl( x ); }
-
-float nearbyint( float x ) { return nearbyintf( x ); }
-long double nearbyint( long double x ) { return nearbyintl( x ); }
+//---------------------- Manipulation ----------------------
+
+float copysign( float x, float y ) { return copysignf( x, y ); }
+long double copysign( long double x, long double y ) { return copysignl( x, y ); }
+
+float frexp( float x, int *ip ) { return frexpf( x, ip ); }
+long double frexp( long double x, int *ip ) { return frexpl( x, ip ); }
+
+float ldexp( float x, int exp2 ) { return ldexpf( x, exp2 ); }
+long double ldexp( long double x, int exp2 ) { return ldexpl( x, exp2 ); }
+
+// [ float, float ] modf( float x ) { float i; x = modff( x, &i ); return [ i, x ]; }
+float modf( float x, float *i ) { return modff( x, i ); }
+// [ double, double ] modf( double x ) { double i; x = modf( x, &i ); return [ i, x ]; }
+// [ long double, long double ] modf( long double x ) { long double i; x = modfl( x, &i ); return [ i, x ]; }
+long double modf( long double x, long double *i ) { return modfl( x, i ); }
 
 float nextafter( float x, float y ) { return nextafterf( x, y ); }
@@ -233,13 +291,4 @@
 float nexttoward( float x, long double y ) { return nexttowardf( x, y ); }
 long double nexttoward( long double x, long double y ) { return nexttowardl( x, y ); }
-
-float remainder( float x, float y ) { return remainderf( x, y ); }
-long double remainder( long double x, long double y ) { return remainderl( x, y ); }
-
-//[ int, float ] remquo( float x, float y ) { int quo; x = remquof( x, y, &quo ); return [ quo, x ]; }
-float remquo( float x, float y, int *quo ) { return remquof( x, y, quo ); }
-//[ int, double ] remquo( double x, double y ) { int quo; x = remquo( x, y, &quo ); return [ quo, x ]; }
-//[ int, long double ] remquo( long double x, long double y ) { int quo; x = remquol( x, y, &quo ); return [ quo, x ]; }
-long double remquo( long double x, long double y, int *quo ) { return remquol( x, y, quo ); }
 
 float scalbn( float x, int exp ) { return scalbnf( x, exp ); }
@@ -252,10 +301,4 @@
 long double scalbln( long double x, long int exp ) { return scalblnl( x, exp ); }
 
-float tgamma( float x ) { return tgammaf( x ); }
-long double tgamma( long double x ) { return tgammal( x ); }
-
-float trunc( float x ) { return truncf( x ); }
-long double trunc( long double x ) { return truncl( x ); }
-
 // Local Variables: //
 // mode: c //
