BigMath Class

Step 1: problem domain

  • Main goal of this class is implementing Math methods to Big Numbers (BigInt and BigDouble base objects).
  • Some methods of Java Math should be implemented for Big Numbers.
  • BigInt and BigDouble classes can be used in BigMath class.
  • BigMath class should be final.
  • Methods of this class should be accessible like Math methods (static methods).

Step 2: Public Interface

In this section we have just static methods as following:

(Description of each method is here: Java Math Class)

public static BigDouble getE(int DecimalLength); 
// The BigDouble value that is the base of the natural logarithms.
// it should be up to DecimalLength decimal places. 

public static BigDouble getPI(int DecimalLength); 
// The BigDouble value of the ratio of the circumference of a circle to its diameter.
// it should be up to DecimalLength decimal places. 

static BigDouble abs(BigDouble a);
static BigInt abs(BigInt a);

static BigDouble cos(BigDouble a);
static BigDouble cosh(BigDouble x);
static BigDouble acos(BigDouble a);
static BigDouble sin(BigDouble a);
static BigDouble sinh(BigDouble x);
static BigDouble asin(BigDouble a);
static BigDouble tan(BigDouble a);
static BigDouble tanh(BigDouble x);
static BigDouble atan(BigDouble a);
static BigDouble atan2(BigDouble y, BigDouble x);
static BigDouble toDegrees(BigDouble angrad);
static BigDouble toRadians(BigDouble angdeg);

static BigDouble ceil(BigDouble a);
static BigDouble floor(BigDouble a);
static BigDouble round(BigDouble a);

static BigDouble exp(double a);
static BigDouble sqrt(BigDouble a);

static BigDouble log(BigDouble a);
static BigDouble log10(BigDouble a);

static BigDouble max(BigDouble a, BigDouble b);
static BigInt max(BigInt a, BigInt b);
static BigDouble min(BigDouble a, BigDouble b);
static BigInt min(BigInt a, BigInt b);

static BigDouble pow(double a, double b);
static BigInt BigRandom();

Step 3: private variables

BigMath does not have any private variable.

Step 4: implementing main classes

Students work !

Students should find HOW. (Taylor Series can be implemented based on Big Numbers.)

Step 5: useful application

This class will be used in BigCALC project.

Step 6: Documentation

Implementing of some methods of this class are sophisticated. So, students should document their method and write details of own approach.