Scol standard library package  0.3.1
Common and usefull functions for all Scol applications
Functions
The math API provides some mathematical functions.

Functions

 std_m2power (x)
 Return the power of two : \(2^{f}\). More...
 
 std_m2powerI (x)
 Return the power of two : \(2^{i}\). More...
 
 std_mDegToRad (f)
 Convert degree to radian. More...
 
 std_mFibonacci (n)
 Return the nth value of the Fibonacci series (1, 1, 2, 3, 5, 8, 13, 21, ...) More...
 
 std_mGCD (int1, int2)
 Return the GCD (Greatest Common Divisor, PGCD in french) of two integers. More...
 
 std_mLCM (int1, int2)
 Return the LCM (Least Common Multiple, PPCM in french) of two integers. More...
 
 std_mPow (i, n)
 Calculate the power of an integer by a quick recursion. More...
 
 std_mPrimeMRDet (iNumber)
 Returns if an integer is a prime number or a composite number. More...
 
 std_mRadToDeg (f)
 Convert radian to degree. More...
 

Detailed Description

Package to load : lib/std/maths.pkg

Dependancies :

Function Documentation

std_mFibonacci ( )

Return the nth value of the Fibonacci series (1, 1, 2, 3, 5, 8, 13, 21, ...)

Remarks
Negative numbers are supported.

Prototype : : fun [I] I

Parameters
I: an integer (-43 to 43 included)
Returns
I : the result or nil if out of range
std_m2power ( )

Return the power of two : \(2^{f}\).

Remarks
Negative numbers are NOT supported.

Prototype : : fun [F] F

Parameters
F: a float number (0 to 127 included)
Returns
F : the result or nil if out of range
std_m2powerI ( )

Return the power of two : \(2^{i}\).

Remarks
Negative numbers are NOT supported.

Prototype : : fun [I] I

Parameters
I: a float number (0 to 29 included)
Returns
I : the result or nil if out of range
std_mDegToRad ( )

Convert degree to radian.

Prototype : : fun [F] F

Parameters
F: a value in degree
Returns
F : the same value in radian
std_mRadToDeg ( )

Convert radian to degree.

Prototype : : fun [F] F

Parameters
F: a value in radian
Returns
F : the same value in degree
std_mGCD ( int1  ,
int2   
)

Return the GCD (Greatest Common Divisor, PGCD in french) of two integers.

Prototype : : fun [I I] I

Parameters
I: a first integer
I: a second integer
Returns
I : the GCD
std_mLCM ( int1  ,
int2   
)

Return the LCM (Least Common Multiple, PPCM in french) of two integers.

Prototype : : fun [I I] I

Parameters
I: a first integer
I: a second integer
Returns
I : the LCM
std_mPow ( ,
 
)

Calculate the power of an integer by a quick recursion.

Prototype : : fun [I I] I

Parameters
I: an integer
I: a power (should be >= 0 otherwise, nil will be returned)
Returns
I : the result or nil if error
std_mPrimeMRDet ( iNumber  )

Returns if an integer is a prime number or a composite number.

This is a deterministic implementation of the Miller-Rabin primality algorithm.

Prototype : : fun [I] I

Parameters
I: an integer
Returns
I : STD_M_COMPOSITE if number is composite, STD_M_PRIME if number is a strong probably prime or nil if error