Cind language documentation

Math linked library

The math library provides some mathematical functions, which may be called from Cind programs.

To connect math library use syntax of getting linked libraries, with "math" word as the second argument:

var lmath = @("lib","math");

For more about connecting libraries see Using linked libraries.

Functions

List of functions available from the math library:

function args type of arguments type of result description
sin 1 float float sine function
cos 1 float float cosine function
tan 1 float float tangent function
asin 1 float float arc sine function
acos 1 float float arc cosine function
atan 1 float float arc tangent function
atan2 2 (float y,float x) float arc tangent function of y/x
sinh 1 float float hyperbolic sine function
cosh 1 float float hyperbolic cosine function
tanh 1 float float hyperbolic tangent function
asinh 1 float float inverse hyperbolic sine function
acosh 1 float float inverse hyperbolic cosine function
atanh 1 float float inverse hyperbolic tangent function
exp 1 float float base-e exponential function
exp2 1 float float base-2 exponential function
expm1 1 float float base-e exponential function minus 1
pow 2 (float x,float y) float power function, returns xy
log 1 float float natural logarithmic function
log1p 1 float float natural logarithm of 1 plus argument
log10 1 float float base-10 logarithmic function
log2 1 float float base-2 logarithmic function
sqrt 1 float float square root function
hypot 2 (float x,float y) float length of the hypotenuse of a right-angled triangle
with sides of length x and y
ldexp 2 (float x,int exp) float multiply float number by integral power of 2
fabs 1 float float absolute value of float number
floor 1 float float largest integral value not greater than argument
ceil 1 float float smallest integral value not less than argument
round 1 float float round to nearest integer
trunc 1 float float round to integer, toward zero
fmod 2 (float x,float y) float floating-point remainder function
remainder 2 (float x,float y) float another floating-point remainder function
tgamma 1 float float the Gamma function
lgamma 1 float float natural logarithm of the absolute value
of the Gamma function


Remarks:

Example of usage

var lmath = @("lib","math"); float x = 0.25f; host.println("sin("+x+") = "+ lmath.sin(x) );

Cind programming language 1.0.4