C# Class CSJ2K.j2k.util.MathUtil

This class contains a collection of utility methods fro mathematical operations. All methods are static.
Show file Open project: cureos/csj2k

Public Methods

Method Description
gcd ( int x ) : int

Method that calculates the Greatest Common Divisor (GCD) of several positive integer numbers.

gcd ( int x1, int x2 ) : int

Method that calculates the Greatest Common Divisor (GCD) of two positive integer numbers.

lcm ( int x ) : int

Method that calculates the Least Common Multiple (LCM) of several positive integer numbers.

lcm ( int x1, int x2 ) : int

Method that calculates the Least Common Multiple (LCM) of two strictly positive integer numbers.

log2 ( int x ) : int

Method that calculates the floor of the log, base 2, of 'x'. The calculation is performed in integer arithmetic, therefore, it is exact.

Method Details

gcd() public static method

Method that calculates the Greatest Common Divisor (GCD) of several positive integer numbers.
public static gcd ( int x ) : int
x int Array containing the numbers. /// ///
return int

gcd() public static method

Method that calculates the Greatest Common Divisor (GCD) of two positive integer numbers.
public static gcd ( int x1, int x2 ) : int
x1 int
x2 int
return int

lcm() public static method

Method that calculates the Least Common Multiple (LCM) of several positive integer numbers.
public static lcm ( int x ) : int
x int Array containing the numbers. /// ///
return int

lcm() public static method

Method that calculates the Least Common Multiple (LCM) of two strictly positive integer numbers.
public static lcm ( int x1, int x2 ) : int
x1 int First number /// ///
x2 int Second number /// ///
return int

log2() public static method

Method that calculates the floor of the log, base 2, of 'x'. The calculation is performed in integer arithmetic, therefore, it is exact.
public static log2 ( int x ) : int
x int The value to calculate log2 on. /// ///
return int