(: generated by: arc -uNMLP -o math.c -H math.h -m math.argl.tmp math.arg :) (:: : math.arg -- math functions for Argile : : Copyright (C) 2009,2010,2011 the Argile authors : : This file is part of libargrt -- Argile runtime library. : : This software is provided 'as-is', without any express or implied : warranty. In no event will the authors be held liable for any damages : arising from the use of this software. : : Permission is granted to anyone to use this software for any purpose, : including commercial applications, and to alter it and redistribute it : freely, subject to the following restrictions: : : 1. The origin of this software must not be misrepresented; you must not : claim that you wrote the original software. If you use this software : in a product, an acknowledgment in the product documentation would be : appreciated but is not required. : : 2. Altered source versions must be plainly marked as such, and must not : be misrepresented as being the original software. : : 3. This notice may not be removed or altered from any source : distribution. :) use std; # extern M_E - > (real); # extern M_LOG2E - > (real); # extern M_LOG10E - > (real); # extern M_LN2 - > (real); # extern M_LN10 - > (real); # extern M_PI - > (real); # extern M_PI_2 - > (real); # extern M_PI_4 - > (real); # extern M_1_PI - > (real); # extern M_2_PI - > (real); # extern M_2_SQRTPI - > (real); # extern M_SQRT2 - > (real); # extern M_SQRT1_2 - > (real); = : in \[ , ]: = - > (bool) { ((i) > = (min)) and ((i) < = (max)); }; = : in - : = - > (bool) { ((b) > = (min)) and ((b) < = (max)); }; = :| |: = - > (nat) { ((super (:[:) | (x) | (:]:)) the (int)) as (nat); }; = :| |: = - > (int) { Cgen "abs(" (x) ")"; }; = :| |: = - > (float) { Cgen "fabsf(" (x) ")"; }; = :| |: = - > (real) { Cgen "fabs(" (x) ")"; }; = : ²: = - > (nat) { argrt_math_sqint (x); }; = : ²: = - > (nat) { argrt_math_sqnat (x); }; = : ²: = - > (float) { argrt_math_sqfloat (x); }; = : ²: = - > (real) { argrt_math_sqreal (x); }; def func argrt_math_sqint :argrt_math_sqint : - > (nat); def func argrt_math_sqnat :argrt_math_sqnat : - > (nat); def func argrt_math_sqfloat :argrt_math_sqfloat : - > (r32); def func argrt_math_sqreal :argrt_math_sqreal : - > (real); = :sqrt : = - > (float) { Cgen "sqrtf(" (x) ")"; }; = :sqrt : = - > (real) { Cgen "sqrt(" (x) ")"; }; = :cbrt : = - > (float) { Cgen "cbrtf(" (x) ")"; }; = :cbrt : = - > (real) { Cgen "cbrt(" (x) ")"; }; = :hypot : = - > (float) { Cgen "hypotf(" (x) ", " (y) ")"; }; = :hypot : = - > (real) { Cgen "hypot(" (x) ", " (y) ")"; }; = : ^ : = - > (float) { Cgen "powf(" (x) ", " (y) ")"; }; = : ^ : = - > (real) { Cgen "pow(" (x) ", " (y) ")"; }; = :pow10 : = - > (float) { Cgen "pow10f(" (x) ")"; }; = :pow10 : = - > (real) { Cgen "pow10(" (x) ")"; }; = : !: = - > (int) { argrt_math_fact_int (x); }; = : !: = - > (nat) { argrt_math_fact_nat (x); }; def func argrt_math_fact_int :argrt_math_fact_int : - > (int); def func argrt_math_fact_nat :argrt_math_fact_nat : - > (nat); = :acos : = - > (float) { Cgen "acosf(" (x) ")"; }; = :acos : = - > (real) { Cgen "acos(" (x) ")"; }; = :asin : = - > (float) { Cgen "asinf(" (x) ")"; }; = :asin : = - > (real) { Cgen "asin(" (x) ")"; }; = :atan : = - > (float) { Cgen "atanf(" (x) ")"; }; = :atan : = - > (real) { Cgen "atan(" (x) ")"; }; = :atan2 : = - > (float) { Cgen "atan2f(" (y) ", " (x) ")"; }; = :atan2 : = - > (real) { Cgen "atan2(" (y) ", " (x) ")"; }; = :cos : = - > (float) { Cgen "cosf(" (x) ")"; }; = :cos : = - > (real) { Cgen "cos(" (x) ")"; }; = :sin : = - > (float) { Cgen "sinf(" (x) ")"; }; = :sin : = - > (real) { Cgen "sin(" (x) ")"; }; = :tan : = - > (float) { Cgen "tanf(" (x) ")"; }; = :tan : = - > (real) { Cgen "tan(" (x) ")"; }; = :cosh : = - > (float) { Cgen "coshf(" (x) ")"; }; = :cosh : = - > (real) { Cgen "cosh(" (x) ")"; }; = :sinh : = - > (float) { Cgen "sinhf(" (x) ")"; }; = :sinh : = - > (real) { Cgen "sinh(" (x) ")"; }; = :tanh : = - > (float) { Cgen "tanhf(" (x) ")"; }; = :tanh : = - > (real) { Cgen "tanh(" (x) ")"; }; = :sincos <(float) & sin> <(float) & cos>: = { Cgen "sincosf(" (x) ", " (sin) ", " (cos) ")"; }; = :sincos <(real) & sin> <(real) & cos>: = { Cgen "sincos(" (x) ", " (sin) ", " (cos) ")"; }; = :acosh : = - > (float) { Cgen "acoshf(" (x) ")"; }; = :acosh : = - > (real) { Cgen "acosh(" (x) ")"; }; = :asinh : = - > (float) { Cgen "asinhf(" (x) ")"; }; = :asinh : = - > (real) { Cgen "asinh(" (x) ")"; }; = :atanh : = - > (float) { Cgen "atanhf(" (x) ")"; }; = :atanh : = - > (real) { Cgen "atanh(" (x) ")"; }; = :ceil : = - > (float) { Cgen "ceilf(" (x) ")"; }; = :ceil : = - > (real) { Cgen "ceil(" (x) ")"; }; = :floor : = - > (float) { Cgen "floorf(" (x) ")"; }; = :floor : = - > (real) { Cgen "floor(" (x) ")"; }; = :trunc : = - > (float) { Cgen "truncf(" (x) ")"; }; = :trunc : = - > (real) { Cgen "trunc(" (x) ")"; }; = :nearbyint : = - > (float) { Cgen "nearbyintf(" (x) ")"; }; = :nearbyint : = - > (real) { Cgen "nearbyint(" (x) ")"; }; = :rint : = - > (float) { Cgen "rintf(" (x) ")"; }; = :rint : = - > (real) { Cgen "rint(" (x) ")"; }; = :lrint : = - > (long) { Cgen "lrintf(" (x) ")"; }; = :lrint : = - > (long) { Cgen "lrint(" (x) ")"; }; = :round : = - > (float) { Cgen "roundf(" (x) ")"; }; = :round : = - > (real) { Cgen "round(" (x) ")"; }; = :lround : = - > (long) { Cgen "lroundf(" (x) ")"; }; = :lround : = - > (long) { Cgen "lround(" (x) ")"; }; = :modf <(float) & iptr>: = - > (float) { Cgen "modff(" (x) ", &" (iptr) ")"; }; = :modf <(real) & iptr>: = - > (real) { Cgen "modf(" (x) ", &" (iptr) ")"; }; = :fmod : = - > (float) { Cgen "fmodf(" (x) ", " (y) ")"; }; = :fmod : = - > (real) { Cgen "fmod(" (x) ", " (y) ")"; }; = :fdim : = - > (float) { Cgen "fdimf(" (x) ", " (y) ")"; }; = :fdim : = - > (real) { Cgen "fdim(" (x) ", " (y) ")"; }; = :fmax : = - > (float) { Cgen "fmaxf(" (x) ", " (y) ")"; }; = :fmax : = - > (real) { Cgen "fmax(" (x) ", " (y) ")"; }; = :fmin : = - > (float) { Cgen "fminf(" (x) ", " (y) ")"; }; = :fmin : = - > (real) { Cgen "fmin(" (x) ", " (y) ")"; }; = :remainder : = - > (float) { Cgen "remainderf(" (x) ", " (y) ")"; }; = :remainder : = - > (real) { Cgen "remainder(" (x) ", " (y) ")"; }; = :remquo <(int) & q>: = - > (float) { Cgen "remquof(" (x) ", " (y) ", " (q) ")"; }; = :remquo <(int) & q>: = - > (real) { Cgen "remquo(" (x) ", " (y) ", " (q) ")"; }; = :exp : = - > (float) { Cgen "expf(" (x) ")"; }; = :exp : = - > (real) { Cgen "exp(" (x) ")"; }; = :frexp <(int) & e>: = - > (float) { Cgen "frexpf(" (x) ", " (e) ")"; }; = :frexp <(int) & e>: = - > (real) { Cgen "frexp(" (x) ", " (e) ")"; }; = :ldexp : = - > (float) { Cgen "ldexpf(" (x) ", " (e) ")"; }; = :ldexp : = - > (real) { Cgen "ldexp(" (x) ", " (e) ")"; }; = :log : = - > (float) { Cgen "logf(" (x) ")"; }; = :log : = - > (real) { Cgen "log(" (x) ")"; }; = :exp10 : = - > (float) { Cgen "exp10f(" (x) ")"; }; = :exp10 : = - > (real) { Cgen "exp10(" (x) ")"; }; = :log10 : = - > (float) { Cgen "log10f(" (x) ")"; }; = :log10 : = - > (real) { Cgen "log10(" (x) ")"; }; = :expm1 : = - > (float) { Cgen "expm1f(" (x) ")"; }; = :expm1 : = - > (real) { Cgen "expm1(" (x) ")"; }; = :log1p : = - > (float) { Cgen "log1pf(" (x) ")"; }; = :log1p : = - > (real) { Cgen "log1p(" (x) ")"; }; = :logb : = - > (float) { Cgen "logbf(" (x) ")"; }; = :logb : = - > (real) { Cgen "logb(" (x) ")"; }; = :exp2 : = - > (float) { Cgen "exp2f(" (x) ")"; }; = :exp2 : = - > (real) { Cgen "exp2(" (x) ")"; }; = :log2 : = - > (float) { Cgen "log2f(" (x) ")"; }; = :log2 : = - > (real) { Cgen "log2(" (x) ")"; }; = :ilogb : = - > (int) { Cgen "ilogbf(" (x) ")"; }; = :ilogb : = - > (int) { Cgen "ilogb(" (x) ")"; }; = :significand : = - > (float) { Cgen "significandf(" (x) ")"; }; = :significand : = - > (real) { Cgen "significand(" (x) ")"; }; = :copysign : = - > (float) { Cgen "copysignf(" (x) ", " (y) ")"; }; = :copysign : = - > (real) { Cgen "copysign(" (x) ", " (y) ")"; }; = :isfinite : = - > (bool) { Cgen "isfinite(" (x) ")"; }; = :isinf : = - > (bool) { Cgen "isinf(" (x) ")"; }; = :isnan : = - > (bool) { Cgen "isnan(" (x) ")"; }; = :isnormal : = - > (bool) { Cgen "isnormal(" (x) ")"; }; = :NaN (): = - > (float) { Cgen "nanf(" (tag) ")"; }; = :NaN (): = - > (real) { Cgen "nan(" (tag) ")"; }; = :scalb : = - > (float) { Cgen "scalblnf(" (x) ", " (e) ")"; }; = :scalb : = - > (real) { Cgen "scalbln(" (x) ", " (e) ")"; }; = :scalb : = - > (float) { Cgen "scalbnf(" (x) ", " (e) ")"; }; = :scalb : = - > (real) { Cgen "scalbn(" (x) ", " (e) ")"; }; = :scalb : = - > (float) { Cgen "scalbf(" (x) ", " (e) ")"; }; = :scalb : = - > (real) { Cgen "scalb(" (x) ", " (e) ")"; }; = :fma : = - > (float) { Cgen "fmaf(" (x) ", " (y) ", " (z) ")"; }; = :fma : = - > (real) { Cgen "fma(" (x) ", " (y) ", " (z) ")"; }; = : * + : = - > (float) { fma (x) (y) (z); }; = : * + : = - > (real) { fma (x) (y) (z); };