MATH LIBRARY
A Programming Language Manual




gs_sgn
( lib: Math, file: gslib_math.cpp )
int|float gs_sgn( n )

IN
int|float n number
OUT
int|float sign -1=negative,0=zero,1=positive

Returns the sign of the integer or float number n (accepts both types).
Returns -1 if n is negative, 0 if equal to zero and 1 if positive.




 C/C++ source code


gs_abs
( lib: Math, file: gslib_math.cpp )
int|float gs_abs( n )

IN
int|float n number
OUT
int|float absolute value

Returns the same value if n is positive and -n if it's negative.
The result is always greater or equal to zero.




 C/C++ source code


gs_floor
( lib: Math, file: gslib_math.cpp )
float gs_floor( n )

IN
float n number
OUT
float floor value

Returns the integer part of n.



 C/C++ source code


gs_ceil
( lib: Math, file: gslib_math.cpp )
float gs_ceil( n )

IN
float n number
OUT
float ceil value

Returns the integer part n+1



 C/C++ source code


gs_round
( lib: Math, file: gslib_math.cpp )
float gs_round( n )

IN
float n number
OUT
float rounded value

Returns the closest integer value to the specified number.
If the fractional part of the n is less than 0.5, it will return the floor, otherwise it will return the ceil.




 C/C++ source code


gs_trunc
( lib: Math, file: gslib_math.cpp )
float gs_trunc( n, decimals=5 )

IN
float n number
float decimals=5 count of decimals to keep (optional)
OUT
float truncated number

Will return the same value of n, but only with the specifed number of decimals.
Even if #decimals has a float type, only integer values will make sence for it.




 C/C++ source code


gs_exp
( lib: Math, file: gslib_math.cpp )
float gs_exp( n )

IN
float n number
OUT
float e rised to the power of n

Returns the result of the exponential function, applied on n.

 C/C++ source code


gs_log
( lib: Math, file: gslib_math.cpp )
float gs_log( n )

IN
float n
OUT
float natural logarithm of n

Returns the result of the natural logarithm function applied on n.

 C/C++ source code


gs_pow
( lib: Math, file: gslib_math.cpp )
float gs_pow( n, p )

IN
float n number
float p exponent
OUT
float n raised to power of p

Returns the result of n raised to the power of p.



 C/C++ source code


gs_sqrt
( lib: Math, file: gslib_math.cpp )
float gs_sqrt( n )

IN
float n number
OUT
float square root of n

Returns the square rood of n

 C/C++ source code


gs_sin
( lib: Math, file: gslib_math.cpp )
float gs_sin( a )

IN
float a radians
OUT
float sine of a

Calculates sine from angle a in radians (~7 exact decimals).

 C/C++ source code


gs_cos
( lib: Math, file: gslib_math.cpp )
float gs_cos( a )

IN
float a radians
OUT
float cosine of a

Calculates cosine from angle a in radians (~7 exact decimals).

 C/C++ source code


gs_tan
( lib: Math, file: gslib_math.cpp )
float gs_tan( a )

IN
float a radians
OUT
float tangent of a

Calculates tangent from angle a in radians (~7 exact decimals).

 C/C++ source code


gs_asin
( lib: Math, file: gslib_math.cpp )
float gs_asin( n )

IN
float n number
OUT
float arcsine of n, in radians

Calculate arcsine from n, returning angle in radians.

 C/C++ source code


gs_acos
( lib: Math, file: gslib_math.cpp )
float gs_acos( n )

IN
float n number
OUT
float arccosine of n, in radians

Calculate arccosine from n, returning angle in radians.

 C/C++ source code


gs_atan
( lib: Math, file: gslib_math.cpp )
float gs_atan( n )

IN
float n number
OUT
float arctangent of n, in radians

Calculate arctangent from n, returning angle radians.

 C/C++ source code


PI
( lib: Math, file: gslib_math.cpp )
3.1415926535897932385

Define with the value of PI.


PI2
( lib: Math, file: gslib_math.cpp )
6.283185307179586477

Define with the value of 2*PI.


DEG2RAD
( lib: Math, file: gslib_math.cpp )
PI / 180.0

Multiply this with degrees to convert them into radians.


RAD2DEG
( lib: Math, file: gslib_math.cpp )
180.0 / PI

Multiply this with radians to convert them into degrees.