Permalink
Browse files

Add libm wrapper

  • Loading branch information...
1 parent 142f853 commit 5d93e01766a8377b7ba47d6f96d14a6a97624a7e Jeremy Clifford committed Apr 18, 2012
Showing with 423 additions and 278 deletions.
  1. +278 −277 lib-clay/math/libm/libm.clay
  2. +144 −0 lib-clay/math/libm/wrapper.clay
  3. +1 −1 lib-clay/math/math.clay
View
555 lib-clay/math/libm/libm.clay
@@ -2,191 +2,192 @@ import libc;
public import math.native.defines.*;
public import numbers.floats.*;
-alias LIBM = "libm";
-MathMode?(m) = Flag("math.Mode")==m;
-
-[when MathMode?(LIBM)] inline overload pow(x:Double,y:Double) = libc.pow(x,y);
+inline overload pow(x:Double,y:Double) = libc.pow(x,y);
inline overload pow(x:Float,y:Float) = libc.powf(x,y);
inline overload pow(x:LongDouble,y:LongDouble) = libc.powl(x,y);
-[when MathMode?(LIBM)] inline overload pow(x:Double,y:Float) = libc.pow(x,Double(y));
-[when MathMode?(LIBM)] inline overload pow(x:Float,y:Double) = libc.pow(Double(x),y);
+inline overload pow(x:Double,y:Float) = libc.pow(x,Double(y));
+inline overload pow(x:Float,y:Double) = libc.pow(Double(x),y);
inline overload pow(x:Double,y:LongDouble) = libc.powl(LongDouble(x),y);
inline overload pow(x:LongDouble,y:Double) = libc.powl(x,LongDouble(y));
inline overload pow(x:Float,y:LongDouble) = libc.powl(LongDouble(x),y);
inline overload pow(x:LongDouble,y:Float) = libc.powl(x,LongDouble(y));
-[T when Integer?(T) and MathMode?(LIBM)] inline overload pow(x:Double,y:T) = libc.pow(x,Double(y));
+[T when Integer?(T)] inline overload pow(x:Double,y:T) = libc.pow(x,Double(y));
[T when Integer?(T)] inline overload pow(x:Float,y:T) = libc.powf(x,Float(y));
[T when Integer?(T)] inline overload pow(x:LongDouble,y:T) = libc.powl(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload exp(x:Double) = libc.exp(x);
-[when MathMode?(LIBM)] inline overload exp(x:Float) = libc.expf(x);
+inline overload abs(x:Double) = libc.abs(x);
+inline overload abs(x:Float) = libc.absf(x);
+inline overload abs(x:LongDouble) = libc.absl(x);
+
+inline overload exp(x:Double) = libc.exp(x);
+inline overload exp(x:Float) = libc.expf(x);
inline overload exp(x:LongDouble) = libc.expl(x);
-[when MathMode?(LIBM)] inline overload log(x:Double) = libc.log(x);
-[when MathMode?(LIBM)] inline overload log(x:Float) = libc.logf(x);
+inline overload log(x:Double) = libc.log(x);
+inline overload log(x:Float) = libc.logf(x);
inline overload log(x:LongDouble) = libc.logl(x);
-[when MathMode?(LIBM)] inline overload acos(x:Double) = libc.acos(x);
+inline overload acos(x:Double) = libc.acos(x);
inline overload acos(x:Float) = libc.acosf(x);
inline overload acos(x:LongDouble) = libc.acosl(x);
-[when MathMode?(LIBM)] inline overload asin(x:Double) = libc.asin(x);
+inline overload asin(x:Double) = libc.asin(x);
inline overload asin(x:Float) = libc.asinf(x);
inline overload asin(x:LongDouble) = libc.asinl(x);
-[when MathMode?(LIBM)] inline overload atan(x:Double) = libc.atan(x);
+inline overload atan(x:Double) = libc.atan(x);
inline overload atan(x:Float) = libc.atanf(x);
inline overload atan(x:LongDouble) = libc.atanl(x);
-[when MathMode?(LIBM)] inline overload atan2(x:Double,y:Double) = libc.atan2(x,y);
-[when MathMode?(LIBM)] inline overload atan2(x:Float,y:Float) = libc.atan2f(x,y);
-[when MathMode?(LIBM)] inline overload atan2(x:LongDouble,y:LongDouble) = libc.atan2l(x,y);
-[when MathMode?(LIBM)] inline overload atan2(x:Double,y:Float) = libc.atan2(x,Double(y));
-[when MathMode?(LIBM)] inline overload atan2(x:Float,y:Double) = libc.atan2(Double(x),y);
+inline overload atan2(x:Double,y:Double) = libc.atan2(x,y);
+inline overload atan2(x:Float,y:Float) = libc.atan2f(x,y);
+inline overload atan2(x:LongDouble,y:LongDouble) = libc.atan2l(x,y);
+inline overload atan2(x:Double,y:Float) = libc.atan2(x,Double(y));
+inline overload atan2(x:Float,y:Double) = libc.atan2(Double(x),y);
inline overload atan2(x:Double,y:LongDouble) = libc.atan2l(LongDouble(x),y);
inline overload atan2(x:LongDouble,y:Double) = libc.atan2l(x,LongDouble(y));
inline overload atan2(x:Float,y:LongDouble) = libc.atan2l(LongDouble(x),y);
inline overload atan2(x:LongDouble,y:Float) = libc.atan2l(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload cos(x:Double) = libc.cos(x);
+inline overload cos(x:Double) = libc.cos(x);
inline overload cos(x:Float) = libc.cosf(x);
inline overload cos(x:LongDouble) = libc.cosl(x);
-[when MathMode?(LIBM)] inline overload sin(x:Double) = libc.sin(x);
+inline overload sin(x:Double) = libc.sin(x);
inline overload sin(x:Float) = libc.sinf(x);
inline overload sin(x:LongDouble) = libc.sinl(x);
-[when MathMode?(LIBM)] inline overload tan(x:Double) = libc.tan(x);
+inline overload tan(x:Double) = libc.tan(x);
inline overload tan(x:Float) = libc.tanf(x);
inline overload tan(x:LongDouble) = libc.tanl(x);
-[when MathMode?(LIBM)] inline overload cosh(x:Double) = libc.cosh(x);
-[when MathMode?(LIBM)] inline overload cosh(x:Float) = libc.coshf(x);
-[when MathMode?(LIBM)] inline overload cosh(x:LongDouble) = libc.coshl(x);
+inline overload cosh(x:Double) = libc.cosh(x);
+inline overload cosh(x:Float) = libc.coshf(x);
+inline overload cosh(x:LongDouble) = libc.coshl(x);
-[when MathMode?(LIBM)] inline overload sinh(x:Double) = libc.sinh(x);
-[when MathMode?(LIBM)] inline overload sinh(x:Float) = libc.sinhf(x);
-[when MathMode?(LIBM)] inline overload sinh(x:LongDouble) = libc.sinhl(x);
+inline overload sinh(x:Double) = libc.sinh(x);
+inline overload sinh(x:Float) = libc.sinhf(x);
+inline overload sinh(x:LongDouble) = libc.sinhl(x);
-[when MathMode?(LIBM)] inline overload tanh(x:Double) = libc.tanh(x);
-[when MathMode?(LIBM)] inline overload tanh(x:Float) = libc.tanhf(x);
-[when MathMode?(LIBM)] inline overload tanh(x:LongDouble) = libc.tanhl(x);
+inline overload tanh(x:Double) = libc.tanh(x);
+inline overload tanh(x:Float) = libc.tanhf(x);
+inline overload tanh(x:LongDouble) = libc.tanhl(x);
-[when MathMode?(LIBM)] inline overload acosh(x:Double) = libc.acosh(x);
-[when MathMode?(LIBM)] inline overload acosh(x:Float) = libc.acoshf(x);
-[when MathMode?(LIBM)] inline overload acosh(x:LongDouble) = libc.acoshl(x);
+inline overload acosh(x:Double) = libc.acosh(x);
+inline overload acosh(x:Float) = libc.acoshf(x);
+inline overload acosh(x:LongDouble) = libc.acoshl(x);
-[when MathMode?(LIBM)] inline overload asinh(x:Double) = libc.asinh(x);
-[when MathMode?(LIBM)] inline overload asinh(x:Float) = libc.asinhf(x);
-[when MathMode?(LIBM)] inline overload asinh(x:LongDouble) = libc.asinhl(x);
+inline overload asinh(x:Double) = libc.asinh(x);
+inline overload asinh(x:Float) = libc.asinhf(x);
+inline overload asinh(x:LongDouble) = libc.asinhl(x);
-[when MathMode?(LIBM)] inline overload atanh(x:Double) = libc.atanh(x);
-[when MathMode?(LIBM)] inline overload atanh(x:Float) = libc.atanhf(x);
-[when MathMode?(LIBM)] inline overload atanh(x:LongDouble) = libc.atanhl(x);
+inline overload atanh(x:Double) = libc.atanh(x);
+inline overload atanh(x:Float) = libc.atanhf(x);
+inline overload atanh(x:LongDouble) = libc.atanhl(x);
-[when MathMode?(LIBM)] inline overload log10(x:Double) = libc.log10(x);
+inline overload log10(x:Double) = libc.log10(x);
inline overload log10(x:Float) = libc.log10f(x);
inline overload log10(x:LongDouble) = libc.log10l(x);
-[when MathMode?(LIBM)] inline overload frexp(x:Double, ex:Pointer[Int]) = libc.frexp(x,ex);
+inline overload frexp(x:Double, ex:Pointer[Int]) = libc.frexp(x,ex);
inline overload frexp(x:Float, ex:Pointer[Int]) = libc.frexpf(x,ex);
inline overload frexp(x:LongDouble, ex:Pointer[Int]) = libc.frexpl(x,ex);
-[when MathMode?(LIBM)] inline overload ldexp(x:Double,y:Int) = libc.ldexp(x,y);
+inline overload ldexp(x:Double,y:Int) = libc.ldexp(x,y);
inline overload ldexp(x:Float,y:Int) = libc.ldexpf(x,y);
inline overload ldexp(x:LongDouble,y:Int) = libc.ldexpl(x,y);
-[when MathMode?(LIBM)] inline overload modf(x:Double,iptr:Pointer[Int]) = libc.modf(x,iptr);
+inline overload modf(x:Double,iptr:Pointer[Int]) = libc.modf(x,iptr);
inline overload modf(x:Float,iptr:Pointer[Int]) = libc.modff(x,iptr);
inline overload modf(x:LongDouble,iptr:Pointer[Int]) = libc.modfl(x,iptr);
-[when MathMode?(LIBM)] inline overload hypot(x:Double,y:Double) = libc.hypot(x,y);
-[when MathMode?(LIBM)] inline overload hypot(x:Float,y:Float) = libc.hypotf(x,y);
-[when MathMode?(LIBM)] inline overload hypot(x:LongDouble,y:LongDouble) = libc.hypotl(x,y);
-[when MathMode?(LIBM)] inline overload hypot(x:Double,y:Float) = libc.hypot(x,Double(y));
-[when MathMode?(LIBM)] inline overload hypot(x:Float,y:Double) = libc.hypot(Double(x),y);
-[when MathMode?(LIBM)] inline overload hypot(x:Double,y:LongDouble) = libc.hypotl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload hypot(x:LongDouble,y:Double) = libc.hypotl(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload hypot(x:Float,y:LongDouble) = libc.hypotl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload hypot(x:LongDouble,y:Float) = libc.hypotl(x,LongDouble(y));
-
-[when MathMode?(LIBM)] inline overload expm1(x:Double) = libc.expm1(x);
-[when MathMode?(LIBM)] inline overload expm1(x:Float) = libc.expm1f(x);
-[when MathMode?(LIBM)] inline overload expm1(x:LongDouble) = libc.expm1l(x);
-
-[when MathMode?(LIBM)] inline overload log1p(x:Double) = libc.log1p(x);
-[when MathMode?(LIBM)] inline overload log1p(x:Float) = libc.log1pf(x);
-[when MathMode?(LIBM)] inline overload log1p(x:LongDouble) = libc.log1pl(x);
-
-[when MathMode?(LIBM)] inline overload logb(x:Double) = libc.logb(x);
+inline overload hypot(x:Double,y:Double) = libc.hypot(x,y);
+inline overload hypot(x:Float,y:Float) = libc.hypotf(x,y);
+inline overload hypot(x:LongDouble,y:LongDouble) = libc.hypotl(x,y);
+inline overload hypot(x:Double,y:Float) = libc.hypot(x,Double(y));
+inline overload hypot(x:Float,y:Double) = libc.hypot(Double(x),y);
+inline overload hypot(x:Double,y:LongDouble) = libc.hypotl(LongDouble(x),y);
+inline overload hypot(x:LongDouble,y:Double) = libc.hypotl(x,LongDouble(y));
+inline overload hypot(x:Float,y:LongDouble) = libc.hypotl(LongDouble(x),y);
+inline overload hypot(x:LongDouble,y:Float) = libc.hypotl(x,LongDouble(y));
+
+inline overload expm1(x:Double) = libc.expm1(x);
+inline overload expm1(x:Float) = libc.expm1f(x);
+inline overload expm1(x:LongDouble) = libc.expm1l(x);
+
+inline overload log1p(x:Double) = libc.log1p(x);
+inline overload log1p(x:Float) = libc.log1pf(x);
+inline overload log1p(x:LongDouble) = libc.log1pl(x);
+
+inline overload logb(x:Double) = libc.logb(x);
inline overload logb(x:Float) = libc.logbf(x);
inline overload logb(x:LongDouble) = libc.logbl(x);
-[when MathMode?(LIBM)] inline overload exp2(x:Double) = libc.exp2(x);
+inline overload exp2(x:Double) = libc.exp2(x);
inline overload exp2(x:Float) = libc.exp2f(x);
inline overload exp2(x:LongDouble) = libc.exp2l(x);
-[when MathMode?(LIBM)] inline overload log2(x:Double) = libc.log2(x);
-[when MathMode?(LIBM)] inline overload log2(x:Float) = libc.log2f(x);
-[when MathMode?(LIBM)] inline overload log2(x:LongDouble) = libc.log2l(x);
+inline overload log2(x:Double) = libc.log2(x);
+inline overload log2(x:Float) = libc.log2f(x);
+inline overload log2(x:LongDouble) = libc.log2l(x);
-[when MathMode?(LIBM)] inline overload sqrt(x:Double) = libc.sqrt(x);
-[when MathMode?(LIBM)] inline overload sqrt(x:Float) = libc.sqrtf(x);
+inline overload sqrt(x:Double) = libc.sqrt(x);
+inline overload sqrt(x:Float) = libc.sqrtf(x);
inline overload sqrt(x:LongDouble) = libc.sqrtl(x);
-[when MathMode?(LIBM)] inline overload cbrt(x:Double) = libc.cbrt(x);
-[when MathMode?(LIBM)] inline overload cbrt(x:Float) = libc.cbrtf(x);
-[when MathMode?(LIBM)] inline overload cbrt(x:LongDouble) = libc.cbrtl(x);
+inline overload cbrt(x:Double) = libc.cbrt(x);
+inline overload cbrt(x:Float) = libc.cbrtf(x);
+inline overload cbrt(x:LongDouble) = libc.cbrtl(x);
-[when MathMode?(LIBM)] inline overload floor(x:Double) = libc.floor(x);
-[when MathMode?(LIBM)] inline overload floor(x:Float) = libc.floorf(x);
+inline overload floor(x:Double) = libc.floor(x);
+inline overload floor(x:Float) = libc.floorf(x);
inline overload floor(x:LongDouble) = libc.floorl(x);
-[when MathMode?(LIBM)] inline overload ceil(x:Double) = libc.ceil(x);
-[when MathMode?(LIBM)] inline overload ceil(x:Float) = libc.ceilf(x);
+inline overload ceil(x:Double) = libc.ceil(x);
+inline overload ceil(x:Float) = libc.ceilf(x);
inline overload ceil(x:LongDouble) = libc.ceill(x);
-[when MathMode?(LIBM)] inline overload round(x:Double) = libc.round(x);
-[when MathMode?(LIBM)] inline overload round(x:Float) = libc.roundf(x);
-[when MathMode?(LIBM)] inline overload round(x:LongDouble) = libc.roundl(x);
+inline overload round(x:Double) = libc.round(x);
+inline overload round(x:Float) = libc.roundf(x);
+inline overload round(x:LongDouble) = libc.roundl(x);
-[when MathMode?(LIBM)] inline overload fmod(x:Double,y:Double) = libc.fmod(x,y);
+inline overload fmod(x:Double,y:Double) = libc.fmod(x,y);
inline overload fmod(x:Float,y:Float) = libc.fmodf(x,y);
inline overload fmod(x:LongDouble,y:LongDouble) = libc.fmodl(x,y);
-[when MathMode?(LIBM)] inline overload fmod(x:Double,y:Float) = libc.fmod(x,Double(y));
-[when MathMode?(LIBM)] inline overload fmod(x:Float,y:Double) = libc.fmod(Double(x),y);
+inline overload fmod(x:Double,y:Float) = libc.fmod(x,Double(y));
+inline overload fmod(x:Float,y:Double) = libc.fmod(Double(x),y);
inline overload fmod(x:Double,y:LongDouble) = libc.fmodl(LongDouble(x),y);
inline overload fmod(x:LongDouble,y:Double) = libc.fmodl(x,LongDouble(y));
inline overload fmod(x:Float,y:LongDouble) = libc.fmodl(LongDouble(x),y);
inline overload fmod(x:LongDouble,y:Float) = libc.fmodl(x,LongDouble(y));
private define _isinf;
-[when MathMode?(LIBM)] inline overload _isinf(x:Double) = libc.isinf(x);
-[when MathMode?(LIBM)] inline overload _isinf(x:Float) = libc.isinff(x);
-[when MathMode?(LIBM)] inline overload _isinf(x:LongDouble) = libc.isinfl(x);
+inline overload _isinf(x:Double) = libc.isinf(x);
+inline overload _isinf(x:Float) = libc.isinff(x);
+inline overload _isinf(x:LongDouble) = libc.isinfl(x);
-[T when Float?(T) and MathMode?(LIBM)] inline overload infinity?(x:T) = if(_isinf(x)==1) true else false;
-[T when Float?(T) and MathMode?(LIBM)] inline overload negativeInfinity?(x:T) = if(_isinf(x)==-1) true else false;
+[T when Float?(T)] inline overload infinity?(x:T) = if(_isinf(x)==1) true else false;
+[T when Float?(T)] inline overload negativeInfinity?(x:T) = if(_isinf(x)==-1) true else false;
-[when MathMode?(LIBM)] inline overload finite?(x:Double) = Bool(libc.finite(x));
-[when MathMode?(LIBM)] inline overload finite?(x:Float) = Bool(libc.finitef(x));
-[when MathMode?(LIBM)] inline overload finite?(x:LongDouble) = Bool(libc.finitel(x));
+inline overload finite?(x:Double) = Bool(libc.finite(x));
+inline overload finite?(x:Float) = Bool(libc.finitef(x));
+inline overload finite?(x:LongDouble) = Bool(libc.finitel(x));
-[when MathMode?(LIBM)] inline overload drem(x:Double,y:Double) = libc.drem(x,y);
-[when MathMode?(LIBM)] inline overload drem(x:Float,y:Float) = libc.dremf(x,y);
-[when MathMode?(LIBM)] inline overload drem(x:LongDouble,y:LongDouble) = libc.dreml(x,y);
-[when MathMode?(LIBM)] inline overload drem(x:Double,y:Float) = libc.drem(x,Double(y));
-[when MathMode?(LIBM)] inline overload drem(x:Float,y:Double) = libc.drem(Double(x),y);
-[when MathMode?(LIBM)] inline overload drem(x:Double,y:LongDouble) = libc.dreml(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload drem(x:LongDouble,y:Double) = libc.dreml(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload drem(x:Float,y:LongDouble) = libc.dreml(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload drem(x:LongDouble,y:Float) = libc.dreml(x,LongDouble(y));
+inline overload drem(x:Double,y:Double) = libc.drem(x,y);
+inline overload drem(x:Float,y:Float) = libc.dremf(x,y);
+inline overload drem(x:LongDouble,y:LongDouble) = libc.dreml(x,y);
+inline overload drem(x:Double,y:Float) = libc.drem(x,Double(y));
+inline overload drem(x:Float,y:Double) = libc.drem(Double(x),y);
+inline overload drem(x:Double,y:LongDouble) = libc.dreml(LongDouble(x),y);
+inline overload drem(x:LongDouble,y:Double) = libc.dreml(x,LongDouble(y));
+inline overload drem(x:Float,y:LongDouble) = libc.dreml(LongDouble(x),y);
+inline overload drem(x:LongDouble,y:Float) = libc.dreml(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload nan?(x:Double) = Bool(libc.isnan(x));
-[when MathMode?(LIBM)] inline overload nan?(x:Float) = Bool(libc.isnanf(x));
-[when MathMode?(LIBM)] inline overload nan?(x:LongDouble) = Bool(libc.isnanl(x));
+inline overload nan?(x:Double) = Bool(libc.isnan(x));
+inline overload nan?(x:Float) = Bool(libc.isnanf(x));
+inline overload nan?(x:LongDouble) = Bool(libc.isnanl(x));
inline overload jn(x:Int,y:Double) = libc.jn(x,y);
inline overload jn(x:Int,y:Float) = libc.jnf(x,y);
@@ -212,88 +213,88 @@ inline overload yn(x:Int,y:Double) = libc.yn(x,y);
inline overload yn(x:Int,y:Float) = libc.ynf(x,y);
inline overload yn(x:Int,y:LongDouble) = libc.ynl(x,y);
-[when MathMode?(LIBM)] inline overload copysign(x:Double,y:Double) = libc.copysign(x,y);
-[when MathMode?(LIBM)] inline overload copysign(x:Float,y:Float) = libc.copysignf(x,y);
-[when MathMode?(LIBM)] inline overload copysign(x:LongDouble,y:LongDouble) = libc.copysignl(x,y);
-[when MathMode?(LIBM)] inline overload copysign(x:Double,y:Float) = libc.copysign(x,Double(y));
-[when MathMode?(LIBM)] inline overload copysign(x:Float,y:Double) = libc.copysign(Double(x),y);
-[when MathMode?(LIBM)] inline overload copysign(x:Double,y:LongDouble) = libc.copysignl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload copysign(x:LongDouble,y:Double) = libc.copysignl(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload copysign(x:Float,y:LongDouble) = libc.copysignl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload copysign(x:LongDouble,y:Float) = libc.copysignl(x,LongDouble(y));
-
-[when MathMode?(LIBM)] inline overload erf(x:Double) = libc.erf(x);
-[when MathMode?(LIBM)] inline overload erf(x:Float) = libc.erff(x);
-[when MathMode?(LIBM)] inline overload erf(x:LongDouble) = libc.erfl(x);
-
-[when MathMode?(LIBM)] inline overload erfc(x:Double) = libc.erfc(x);
-[when MathMode?(LIBM)] inline overload erfc(x:Float) = libc.erfcf(x);
-[when MathMode?(LIBM)] inline overload erfc(x:LongDouble) = libc.erfcl(x);
-
-[when MathMode?(LIBM)] inline overload lgamma(x:Double) = libc.lgamma(x);
-[when MathMode?(LIBM)] inline overload lgamma(x:Float) = libc.lgammaf(x);
-[when MathMode?(LIBM)] inline overload lgamma(x:LongDouble) = libc.lgammal(x);
-
-[when MathMode?(LIBM)] inline overload tgamma(x:Double) = libc.tgamma(x);
-[when MathMode?(LIBM)] inline overload tgamma(x:Float) = libc.tgammaf(x);
-[when MathMode?(LIBM)] inline overload tgamma(x:LongDouble) = libc.tgammal(x);
-
-[when MathMode?(LIBM)] inline overload gamma_r(x:Double,signgamp:Pointer[Int]) = libc.gamma_r(x,signgamp);
+inline overload copysign(x:Double,y:Double) = libc.copysign(x,y);
+inline overload copysign(x:Float,y:Float) = libc.copysignf(x,y);
+inline overload copysign(x:LongDouble,y:LongDouble) = libc.copysignl(x,y);
+inline overload copysign(x:Double,y:Float) = libc.copysign(x,Double(y));
+inline overload copysign(x:Float,y:Double) = libc.copysign(Double(x),y);
+inline overload copysign(x:Double,y:LongDouble) = libc.copysignl(LongDouble(x),y);
+inline overload copysign(x:LongDouble,y:Double) = libc.copysignl(x,LongDouble(y));
+inline overload copysign(x:Float,y:LongDouble) = libc.copysignl(LongDouble(x),y);
+inline overload copysign(x:LongDouble,y:Float) = libc.copysignl(x,LongDouble(y));
+
+inline overload erf(x:Double) = libc.erf(x);
+inline overload erf(x:Float) = libc.erff(x);
+inline overload erf(x:LongDouble) = libc.erfl(x);
+
+inline overload erfc(x:Double) = libc.erfc(x);
+inline overload erfc(x:Float) = libc.erfcf(x);
+inline overload erfc(x:LongDouble) = libc.erfcl(x);
+
+inline overload lgamma(x:Double) = libc.lgamma(x);
+inline overload lgamma(x:Float) = libc.lgammaf(x);
+inline overload lgamma(x:LongDouble) = libc.lgammal(x);
+
+inline overload tgamma(x:Double) = libc.tgamma(x);
+inline overload tgamma(x:Float) = libc.tgammaf(x);
+inline overload tgamma(x:LongDouble) = libc.tgammal(x);
+
+inline overload gamma_r(x:Double,signgamp:Pointer[Int]) = libc.gamma_r(x,signgamp);
inline overload gamma_r(x:Float,signgamp:Pointer[Int]) = libc.gammaf_r(x,signgamp);
inline overload gamma_r(x:LongDouble,signgamp:Pointer[Int]) = libc.gammal_r(x,signgamp);
-[when MathMode?(LIBM)] inline overload lgamma_r(x:Double,signgamp:Pointer[Int]) = libc.lgamma_r(x,signgamp);
+inline overload lgamma_r(x:Double,signgamp:Pointer[Int]) = libc.lgamma_r(x,signgamp);
inline overload lgamma_r(x:Float,signgamp:Pointer[Int]) = libc.lgammaf_r(x,signgamp);
inline overload lgamma_r(x:LongDouble,signgamp:Pointer[Int]) = libc.lgammal_r(x,signgamp);
-[when MathMode?(LIBM)] inline overload rint(x:Double) = libc.rint(x);
-[when MathMode?(LIBM)] inline overload rint(x:Float) = libc.rintf(x);
-[when MathMode?(LIBM)] inline overload rint(x:LongDouble) = libc.rintl(x);
-
-[when MathMode?(LIBM)] inline overload nextafter(x:Double,y:Double) = libc.nextafter(x,y);
-[when MathMode?(LIBM)] inline overload nextafter(x:Float,y:Float) = libc.nextafterf(x,y);
-[when MathMode?(LIBM)] inline overload nextafter(x:LongDouble,y:LongDouble) = libc.nextafterl(x,y);
-[when MathMode?(LIBM)] inline overload nextafter(x:Double,y:Float) = libc.nextafter(x,Double(y));
-[when MathMode?(LIBM)] inline overload nextafter(x:Float,y:Double) = libc.nextafter(Double(x),y);
-[when MathMode?(LIBM)] inline overload nextafter(x:Double,y:LongDouble) = libc.nextafterl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload nextafter(x:LongDouble,y:Double) = libc.nextafterl(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload nextafter(x:Float,y:LongDouble) = libc.nextafterl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload nextafter(x:LongDouble,y:Float) = libc.nextafterl(x,LongDouble(y));
-
-[when MathMode?(LIBM)] inline overload remainder(x:Double,y:Double) = libc.remainder(x,y);
-[when MathMode?(LIBM)] inline overload remainder(x:Float,y:Float) = libc.remainderf(x,y);
-[when MathMode?(LIBM)] inline overload remainder(x:LongDouble,y:LongDouble) = libc.remainderl(x,y);
-[when MathMode?(LIBM)] inline overload remainder(x:Double,y:Float) = libc.remainder(x,Double(y));
-[when MathMode?(LIBM)] inline overload remainder(x:Float,y:Double) = libc.remainder(Double(x),y);
-[when MathMode?(LIBM)] inline overload remainder(x:Double,y:LongDouble) = libc.remainderl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload remainder(x:LongDouble,y:Double) = libc.remainderl(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload remainder(x:Float,y:LongDouble) = libc.remainderl(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload remainder(x:LongDouble,y:Float) = libc.remainderl(x,LongDouble(y));
-
-[when MathMode?(LIBM)] inline overload scalbn(x:Double,y:Int) = libc.scalbn(x,y);
-[when MathMode?(LIBM)] inline overload scalbn(x:Float,y:Int) = libc.scalbnf(x,y);
-[when MathMode?(LIBM)] inline overload scalbn(x:LongDouble,y:Int) = libc.scalbnl(x,y);
-
-[when MathMode?(LIBM)] inline overload scalbln(x:Double,y:Long) = libc.scalbln(x,y);
+inline overload rint(x:Double) = libc.rint(x);
+inline overload rint(x:Float) = libc.rintf(x);
+inline overload rint(x:LongDouble) = libc.rintl(x);
+
+inline overload nextafter(x:Double,y:Double) = libc.nextafter(x,y);
+inline overload nextafter(x:Float,y:Float) = libc.nextafterf(x,y);
+inline overload nextafter(x:LongDouble,y:LongDouble) = libc.nextafterl(x,y);
+inline overload nextafter(x:Double,y:Float) = libc.nextafter(x,Double(y));
+inline overload nextafter(x:Float,y:Double) = libc.nextafter(Double(x),y);
+inline overload nextafter(x:Double,y:LongDouble) = libc.nextafterl(LongDouble(x),y);
+inline overload nextafter(x:LongDouble,y:Double) = libc.nextafterl(x,LongDouble(y));
+inline overload nextafter(x:Float,y:LongDouble) = libc.nextafterl(LongDouble(x),y);
+inline overload nextafter(x:LongDouble,y:Float) = libc.nextafterl(x,LongDouble(y));
+
+inline overload remainder(x:Double,y:Double) = libc.remainder(x,y);
+inline overload remainder(x:Float,y:Float) = libc.remainderf(x,y);
+inline overload remainder(x:LongDouble,y:LongDouble) = libc.remainderl(x,y);
+inline overload remainder(x:Double,y:Float) = libc.remainder(x,Double(y));
+inline overload remainder(x:Float,y:Double) = libc.remainder(Double(x),y);
+inline overload remainder(x:Double,y:LongDouble) = libc.remainderl(LongDouble(x),y);
+inline overload remainder(x:LongDouble,y:Double) = libc.remainderl(x,LongDouble(y));
+inline overload remainder(x:Float,y:LongDouble) = libc.remainderl(LongDouble(x),y);
+inline overload remainder(x:LongDouble,y:Float) = libc.remainderl(x,LongDouble(y));
+
+inline overload scalbn(x:Double,y:Int) = libc.scalbn(x,y);
+inline overload scalbn(x:Float,y:Int) = libc.scalbnf(x,y);
+inline overload scalbn(x:LongDouble,y:Int) = libc.scalbnl(x,y);
+
+inline overload scalbln(x:Double,y:Long) = libc.scalbln(x,y);
inline overload scalbln(x:Float,y:Long) = libc.scalblnf(x,y);
inline overload scalbln(x:LongDouble,y:Long) = libc.scalblnl(x,y);
-[when MathMode?(LIBM)] inline overload ilogb(x:Double) = libc.ilogb(x);
-[when MathMode?(LIBM)] inline overload ilogb(x:Float) = libc.ilogbf(x);
-[when MathMode?(LIBM)] inline overload ilogb(x:LongDouble) = libc.ilogbl(x);
+inline overload ilogb(x:Double) = libc.ilogb(x);
+inline overload ilogb(x:Float) = libc.ilogbf(x);
+inline overload ilogb(x:LongDouble) = libc.ilogbl(x);
-[when MathMode?(LIBM)] inline overload nearbyint(x:Double) = libc.nearbyint(x);
-[when MathMode?(LIBM)] inline overload nearbyint(x:Float) = libc.nearbyintf(x);
-[when MathMode?(LIBM)] inline overload nearbyint(x:LongDouble) = libc.nearbyintl(x);
+inline overload nearbyint(x:Double) = libc.nearbyint(x);
+inline overload nearbyint(x:Float) = libc.nearbyintf(x);
+inline overload nearbyint(x:LongDouble) = libc.nearbyintl(x);
-[when MathMode?(LIBM)] inline overload round(x:Double) = libc.round(x);
-[when MathMode?(LIBM)] inline overload round(x:Float) = libc.roundf(x);
-[when MathMode?(LIBM)] inline overload round(x:LongDouble) = libc.roundl(x);
+inline overload round(x:Double) = libc.round(x);
+inline overload round(x:Float) = libc.roundf(x);
+inline overload round(x:LongDouble) = libc.roundl(x);
-[when MathMode?(LIBM)] inline overload trunc(x:Double) = libc.trunc(x);
-[when MathMode?(LIBM)] inline overload trunc(x:Float) = libc.truncf(x);
-[when MathMode?(LIBM)] inline overload trunc(x:LongDouble) = libc.truncl(x);
+inline overload trunc(x:Double) = libc.trunc(x);
+inline overload trunc(x:Float) = libc.truncf(x);
+inline overload trunc(x:LongDouble) = libc.truncl(x);
inline overload remquo(x:Double,y:Double) {
var quo = Pointer[Int]();
@@ -312,116 +313,116 @@ inline overload remquo(x:LongDouble,y:LongDouble) {
}
-[when MathMode?(LIBM)] inline overload fdim(x:Double,y:Double) = libc.fdim(x,y);
-[when MathMode?(LIBM)] inline overload fdim(x:Float,y:Float) = libc.fdimf(x,y);
-[when MathMode?(LIBM)] inline overload fdim(x:LongDouble,y:LongDouble) = libc.fdiml(x,y);
-[when MathMode?(LIBM)] inline overload fdim(x:Double,y:Float) = libc.fdim(x,Double(y));
-[when MathMode?(LIBM)] inline overload fdim(x:Float,y:Double) = libc.fdim(Double(x),y);
-[when MathMode?(LIBM)] inline overload fdim(x:Double,y:LongDouble) = libc.fdiml(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload fdim(x:LongDouble,y:Double) = libc.fdiml(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload fdim(x:Float,y:LongDouble) = libc.fdiml(LongDouble(x),y);
-[when MathMode?(LIBM)] inline overload fdim(x:LongDouble,y:Float) = libc.fdiml(x,LongDouble(y));
+inline overload fdim(x:Double,y:Double) = libc.fdim(x,y);
+inline overload fdim(x:Float,y:Float) = libc.fdimf(x,y);
+inline overload fdim(x:LongDouble,y:LongDouble) = libc.fdiml(x,y);
+inline overload fdim(x:Double,y:Float) = libc.fdim(x,Double(y));
+inline overload fdim(x:Float,y:Double) = libc.fdim(Double(x),y);
+inline overload fdim(x:Double,y:LongDouble) = libc.fdiml(LongDouble(x),y);
+inline overload fdim(x:LongDouble,y:Double) = libc.fdiml(x,LongDouble(y));
+inline overload fdim(x:Float,y:LongDouble) = libc.fdiml(LongDouble(x),y);
+inline overload fdim(x:LongDouble,y:Float) = libc.fdiml(x,LongDouble(y));
-[when MathMode?(LIBM)] inline overload fpclassify(value:Double) = libc.__fpclassify(value);
-[when MathMode?(LIBM)] inline overload fpclassify(value:Float) = libc.__fpclassifyf(value);
-[when MathMode?(LIBM)] inline overload fpclassify(value:LongDouble) = libc.__fpclassifyl(value);
+inline overload fpclassify(value:Double) = libc.__fpclassify(value);
+inline overload fpclassify(value:Float) = libc.__fpclassifyf(value);
+inline overload fpclassify(value:LongDouble) = libc.__fpclassifyl(value);
-[when MathMode?(LIBM)] inline overload llrint(x:Double) = libc.llrint(x);
-[when MathMode?(LIBM)] inline overload llrint(x:Float) = libc.llrintf(x);
-[when MathMode?(LIBM)] inline overload llrint(x:LongDouble) = libc.llrintl(x);
+inline overload llrint(x:Double) = libc.llrint(x);
+inline overload llrint(x:Float) = libc.llrintf(x);
+inline overload llrint(x:LongDouble) = libc.llrintl(x);
-[when MathMode?(LIBM)] inline overload llround(x:Double) = libc.llround(x);
+inline overload llround(x:Double) = libc.llround(x);
inline overload llround(x:Float) = libc.llroundf(x);
inline overload llround(x:LongDouble) = libc.llroundl(x);
-[when MathMode?(LIBM)] inline overload signbit(value:Double) = libc.signbit(value);
-[when MathMode?(LIBM)] inline overload signbit(value:Float) = libc.signbitf(value);
-[when MathMode?(LIBM)] inline overload signbit(value:LongDouble) = libc.signbitl(value);
-
-[when MathMode?(LIBM)] inline overload fma(x:Double,y:Double,z:Double) = libc.fma(x,y,z);
-[when MathMode?(LIBM)] inline overload fma(x:Float,y:Float,z:Float) = libc.fmaf(x,y,z);
-[when MathMode?(LIBM)] inline overload fma(x:LongDouble,y:LongDouble,z:LongDouble) = libc.fmal(x,y,z);
-
-[when MathMode?(LIBM)] inline overload abs(z:Complex64) = libc.cabs(z);
-[when MathMode?(LIBM)] inline overload abs(z:Complex32) = libc.cabsf(z);
-[when MathMode?(LIBM)] inline overload abs(z:Complex80) = libc.cabsl(z);
-
-[when MathMode?(LIBM)] inline overload arg(z:Complex64) = libc.carg(z);
-[when MathMode?(LIBM)] inline overload arg(z:Complex32) = libc.cargf(z);
-[when MathMode?(LIBM)] inline overload arg(z:Complex80) = libc.cargl(z);
-
-[when MathMode?(LIBM)] inline overload sin(z:Complex64) = libc.csin(z);
-[when MathMode?(LIBM)] inline overload sin(z:Complex32) = libc.csinf(z);
-[when MathMode?(LIBM)] inline overload sin(z:Complex80) = libc.csinl(z);
-
-[when MathMode?(LIBM)] inline overload cos(z:Complex64) = libc.ccos(z);
-[when MathMode?(LIBM)] inline overload cos(z:Complex32) = libc.ccosf(z);
-[when MathMode?(LIBM)] inline overload cos(z:Complex80) = libc.ccosl(z);
-
-[when MathMode?(LIBM)] inline overload tan(z:Complex64) = libc.ctan(z);
-[when MathMode?(LIBM)] inline overload tan(z:Complex32) = libc.ctanf(z);
-[when MathMode?(LIBM)] inline overload tan(z:Complex80) = libc.ctanl(z);
-
-[when MathMode?(LIBM)] inline overload asin(z:Complex64) = libc.casin(z);
-[when MathMode?(LIBM)] inline overload asin(z:Complex32) = libc.casinf(z);
-[when MathMode?(LIBM)] inline overload asin(z:Complex80) = libc.casinl(z);
-
-[when MathMode?(LIBM)] inline overload acos(z:Complex64) = libc.cacos(z);
-[when MathMode?(LIBM)] inline overload acos(z:Complex32) = libc.cacosf(z);
-[when MathMode?(LIBM)] inline overload acos(z:Complex80) = libc.cacosl(z);
-
-[when MathMode?(LIBM)] inline overload atan(z:Complex64) = libc.catan(z);
-[when MathMode?(LIBM)] inline overload atan(z:Complex32) = libc.catanf(z);
-[when MathMode?(LIBM)] inline overload atan(z:Complex80) = libc.catanl(z);
-
-[when MathMode?(LIBM)] inline overload sinh(z:Complex64) = libc.csinh(z);
-[when MathMode?(LIBM)] inline overload sinh(z:Complex32) = libc.csinhf(z);
-[when MathMode?(LIBM)] inline overload sinh(z:Complex80) = libc.csinhl(z);
-
-[when MathMode?(LIBM)] inline overload cosh(z:Complex64) = libc.ccosh(z);
-[when MathMode?(LIBM)] inline overload cosh(z:Complex32) = libc.ccoshf(z);
-[when MathMode?(LIBM)] inline overload cosh(z:Complex80) = libc.ccoshl(z);
-
-[when MathMode?(LIBM)] inline overload tanh(z:Complex64) = libc.ctanh(z);
-[when MathMode?(LIBM)] inline overload tanh(z:Complex32) = libc.ctanhf(z);
-[when MathMode?(LIBM)] inline overload tanh(z:Complex80) = libc.ctanhl(z);
-
-[when MathMode?(LIBM)] inline overload asinh(z:Complex64) = libc.casinh(z);
-[when MathMode?(LIBM)] inline overload asinh(z:Complex32) = libc.casinhf(z);
-[when MathMode?(LIBM)] inline overload asinh(z:Complex80) = libc.casinhl(z);
-
-[when MathMode?(LIBM)] inline overload acosh(z:Complex64) = libc.cacosh(z);
-[when MathMode?(LIBM)] inline overload acosh(z:Complex32) = libc.cacoshf(z);
-[when MathMode?(LIBM)] inline overload acosh(z:Complex80) = libc.cacoshl(z);
-
-[when MathMode?(LIBM)] inline overload atanh(z:Complex64) = libc.catanh(z);
-[when MathMode?(LIBM)] inline overload atanh(z:Complex32) = libc.catanhf(z);
-[when MathMode?(LIBM)] inline overload atanh(z:Complex80) = libc.catanhl(z);
-
-[when MathMode?(LIBM)] inline overload exp(z:Complex64) = libc.cexp(z);
-[when MathMode?(LIBM)] inline overload exp(z:Complex32) = libc.cexpf(z);
-[when MathMode?(LIBM)] inline overload exp(z:Complex80) = libc.cexpl(z);
-
-[when MathMode?(LIBM)] inline overload log(z:Complex64) = libc.clog(z);
-[when MathMode?(LIBM)] inline overload log(z:Complex32) = libc.clogf(z);
-[when MathMode?(LIBM)] inline overload log(z:Complex80) = libc.clogl(z);
-
-[when MathMode?(LIBM)] inline overload pow(z:Complex64,y:Complex64) = libc.cpow(z,y);
-[when MathMode?(LIBM)] inline overload pow(z:Complex32,y:Complex32) = libc.cpowf(z,y);
-[when MathMode?(LIBM)] inline overload pow(z:Complex80,y:Complex80) = libc.cpowl(z,y);
-[when MathMode?(LIBM)] inline overload pow(z:Complex64,y:Complex32) = libc.cpow(z,Complex64(y));
-[when MathMode?(LIBM)] inline overload pow(z:Complex80,y:Complex32) = libc.cpowl(z,Complex80(y));
-[when MathMode?(LIBM)] inline overload pow(z:Complex80,y:Complex64) = libc.cpowl(z,Complex80(y));
-[when MathMode?(LIBM)] inline overload pow(z:Complex64,y:Complex80) = libc.cpowl(Complex80(z),y);
-[when MathMode?(LIBM)] inline overload pow(z:Complex32,y:Complex64) = libc.cpowl(Complex64(z),y);
-[when MathMode?(LIBM)] inline overload pow(z:Complex32,y:Complex80) = libc.cpowl(Complex80(z),y);
-//Add complex^float & float^complex [when MathMode?(LIBM)] inline overloads
-
-[when MathMode?(LIBM)] inline overload sqrt(z:Complex64) = libc.csqrt(z);
-[when MathMode?(LIBM)] inline overload sqrt(z:Complex32) = libc.csqrtf(z);
-[when MathMode?(LIBM)] inline overload sqrt(z:Complex80) = libc.csqrtl(z);
-
-[when MathMode?(LIBM)] inline overload proj(z:Complex64) = libc.cproj(z);
-[when MathMode?(LIBM)] inline overload proj(z:Complex32) = libc.cprojf(z);
-[when MathMode?(LIBM)] inline overload proj(z:Complex80) = libc.cprojl(z);
+inline overload signbit(value:Double) = libc.signbit(value);
+inline overload signbit(value:Float) = libc.signbitf(value);
+inline overload signbit(value:LongDouble) = libc.signbitl(value);
+
+inline overload fma(x:Double,y:Double,z:Double) = libc.fma(x,y,z);
+inline overload fma(x:Float,y:Float,z:Float) = libc.fmaf(x,y,z);
+inline overload fma(x:LongDouble,y:LongDouble,z:LongDouble) = libc.fmal(x,y,z);
+
+inline overload abs(z:Complex64) = libc.cabs(z);
+inline overload abs(z:Complex32) = libc.cabsf(z);
+inline overload abs(z:Complex80) = libc.cabsl(z);
+
+inline overload arg(z:Complex64) = libc.carg(z);
+inline overload arg(z:Complex32) = libc.cargf(z);
+inline overload arg(z:Complex80) = libc.cargl(z);
+
+inline overload sin(z:Complex64) = libc.csin(z);
+inline overload sin(z:Complex32) = libc.csinf(z);
+inline overload sin(z:Complex80) = libc.csinl(z);
+
+inline overload cos(z:Complex64) = libc.ccos(z);
+inline overload cos(z:Complex32) = libc.ccosf(z);
+inline overload cos(z:Complex80) = libc.ccosl(z);
+
+inline overload tan(z:Complex64) = libc.ctan(z);
+inline overload tan(z:Complex32) = libc.ctanf(z);
+inline overload tan(z:Complex80) = libc.ctanl(z);
+
+inline overload asin(z:Complex64) = libc.casin(z);
+inline overload asin(z:Complex32) = libc.casinf(z);
+inline overload asin(z:Complex80) = libc.casinl(z);
+
+inline overload acos(z:Complex64) = libc.cacos(z);
+inline overload acos(z:Complex32) = libc.cacosf(z);
+inline overload acos(z:Complex80) = libc.cacosl(z);
+
+inline overload atan(z:Complex64) = libc.catan(z);
+inline overload atan(z:Complex32) = libc.catanf(z);
+inline overload atan(z:Complex80) = libc.catanl(z);
+
+inline overload sinh(z:Complex64) = libc.csinh(z);
+inline overload sinh(z:Complex32) = libc.csinhf(z);
+inline overload sinh(z:Complex80) = libc.csinhl(z);
+
+inline overload cosh(z:Complex64) = libc.ccosh(z);
+inline overload cosh(z:Complex32) = libc.ccoshf(z);
+inline overload cosh(z:Complex80) = libc.ccoshl(z);
+
+inline overload tanh(z:Complex64) = libc.ctanh(z);
+inline overload tanh(z:Complex32) = libc.ctanhf(z);
+inline overload tanh(z:Complex80) = libc.ctanhl(z);
+
+inline overload asinh(z:Complex64) = libc.casinh(z);
+inline overload asinh(z:Complex32) = libc.casinhf(z);
+inline overload asinh(z:Complex80) = libc.casinhl(z);
+
+inline overload acosh(z:Complex64) = libc.cacosh(z);
+inline overload acosh(z:Complex32) = libc.cacoshf(z);
+inline overload acosh(z:Complex80) = libc.cacoshl(z);
+
+inline overload atanh(z:Complex64) = libc.catanh(z);
+inline overload atanh(z:Complex32) = libc.catanhf(z);
+inline overload atanh(z:Complex80) = libc.catanhl(z);
+
+inline overload exp(z:Complex64) = libc.cexp(z);
+inline overload exp(z:Complex32) = libc.cexpf(z);
+inline overload exp(z:Complex80) = libc.cexpl(z);
+
+inline overload log(z:Complex64) = libc.clog(z);
+inline overload log(z:Complex32) = libc.clogf(z);
+inline overload log(z:Complex80) = libc.clogl(z);
+
+inline overload pow(z:Complex64,y:Complex64) = libc.cpow(z,y);
+inline overload pow(z:Complex32,y:Complex32) = libc.cpowf(z,y);
+inline overload pow(z:Complex80,y:Complex80) = libc.cpowl(z,y);
+inline overload pow(z:Complex64,y:Complex32) = libc.cpow(z,Complex64(y));
+inline overload pow(z:Complex80,y:Complex32) = libc.cpowl(z,Complex80(y));
+inline overload pow(z:Complex80,y:Complex64) = libc.cpowl(z,Complex80(y));
+inline overload pow(z:Complex64,y:Complex80) = libc.cpowl(Complex80(z),y);
+inline overload pow(z:Complex32,y:Complex64) = libc.cpowl(Complex64(z),y);
+inline overload pow(z:Complex32,y:Complex80) = libc.cpowl(Complex80(z),y);
+//Add complex^float & float^complex inline overloads
+
+inline overload sqrt(z:Complex64) = libc.csqrt(z);
+inline overload sqrt(z:Complex32) = libc.csqrtf(z);
+inline overload sqrt(z:Complex80) = libc.csqrtl(z);
+
+inline overload proj(z:Complex64) = libc.cproj(z);
+inline overload proj(z:Complex32) = libc.cprojf(z);
+inline overload proj(z:Complex80) = libc.cprojl(z);
View
144 lib-clay/math/libm/wrapper.clay
@@ -0,0 +1,144 @@
+import math.native.defines.*;
+import numbers.floats.*;
+import math.libm as lm;
+
+alias LIBM = "libm";
+MathMode?(m) = Flag("math.Mode")==m;
+
+[T,U when MathMode?(LIBM) and (Numeric?(T,U) or Complex?(T,U))] inline overload pow(x:T,y:U) = lm.pow(x,y);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload abs(z:T) = lm.abs(z);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload exp(x:T) = lm.exp(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload log(x:T) = lm.log(x);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload atan2(x:T,y:U) = lm.atan2(x,y);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload acos(x:T) = lm.acos(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload asin(x:T) = lm.asin(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload atan(x:T) = lm.atan(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload cos(x:T) = lm.cos(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload sin(x:T) = lm.sin(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload tan(x:T) = lm.tan(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload cosh(x:T) = lm.cosh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload sinh(x:T) = lm.sinh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload tanh(x:T) = lm.tanh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload acosh(x:T) = lm.acosh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload asinh(x:T) = lm.asinh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload atanh(x:T) = lm.atanh(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload log10(x:T) = lm.log10(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload frexp(x:T, ex:Pointer[Int]) = lm.frexp(x,ex);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload ldexp(x:T,y:Int) = lm.ldexp(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload modf(x:T,iptr:Pointer[Int]) = lm.modf(x,iptr);
+
+[T,U when MathMode?(LIBM) and (Numeric?(T,U) or Complex?(T,U))] inline overload hypot(x:T,y:U) = lm.hypot(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload expm1(x:T) = lm.expm1(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload log1p(x:T) = lm.log1p(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload logb(x:T) = lm.logb(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload exp2(x:T) = lm.exp2(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload log2(x:T) = lm.log2(x);
+
+[T when MathMode?(LIBM) and (Float?(T) or Complex?(T))] inline overload sqrt(x:T) = lm.sqrt(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload cbrt(x:T) = lm.cbrt(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload floor(x:T) = lm.floor(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload ceil(x:T) = lm.ceil(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload round(x:T) = lm.round(x);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload fmod(x:T,y:U) = lm.fmod(x,y);
+
+[T when Float?(T) and MathMode?(LIBM)] inline overload infinity?(x:T) = lm.infinity?(x:T);
+[T when Float?(T) and MathMode?(LIBM)] inline overload negativeInfinity?(x:T) = lm.negativeInfinity?(x:T);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload finite?(x:T) = lm.finite?(x);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload drem(x:T,y:U) = lm.drem(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload nan?(x:T) = lm.nan?(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload jn(x:Int,y:T) = lm.jn(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload j0(x:T) = lm.j0(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload j1(x:T) = lm.j1(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload y0(x:T) = lm.y0(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload y1(x:T) = lm.y1(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload yn(x:Int,y:T) = lm.yn(x,y);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload copysign(x:T,y:U) = lm.copysign(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload erf(x:T) = lm.erf(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload erfc(x:T) = lm.erfc(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload lgamma(x:T) = lm.lgamma(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload tgamma(x:T) = lm.tgamma(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload gamma_r(x:T,signgamp:Pointer[Int]) = lm.gamma_r(x,signgamp);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload lgamma_r(x:T,signgamp:Pointer[Int]) = lm.lgamma_r(x,signgamp);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload rint(x:T) = lm.rint(x);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload nextafter(x:T,y:U) = lm.nextafter(x,y);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload remainder(x:T,y:U) = lm.remainder(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload scalbn(x:T,y:Int) = lm.scalbn(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload scalbln(x:T,y:Long) = lm.scalbln(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload ilogb(x:T) = lm.ilogb(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload nearbyint(x:T) = lm.nearbyint(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload round(x:T) = lm.round(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload trunc(x:T) = lm.trunc(x);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload remquo(x:T,y:U) = lm.remquo(x,y);
+
+[T,U when MathMode?(LIBM) and Float?(T,U)] inline overload fdim(x:T,y:U) = lm.fdim(x,y);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload fpclassify(value:T) = lm.fpclassify(value);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload llrint(x:T) = lm.llrint(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload llround(x:T) = lm.llround(x);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload signbit(value:T) = lm.signbit(value);
+
+[T when MathMode?(LIBM) and Float?(T)] inline overload fma(x:T,y:T,z:T) = lm.fma(x,y,z);
+
+[T when MathMode?(LIBM) and Complex?(T)] inline overload arg(z:T) = lm.arg(z);
+
+[T when MathMode?(LIBM) and Complex?(T)] inline overload proj(z:T) = lm.proj(z);
+
View
2 lib-clay/math/math.clay
@@ -2,4 +2,4 @@
public import numbers.floats.*;
public import complex.*;
public import math.native.*;
-public import math.libm.*;
+public import math.libm.wrapper.*;

0 comments on commit 5d93e01

Please sign in to comment.