Package com.marcosavard.commons.math

## Class Maths

• java.lang.Object
• com.marcosavard.commons.math.Maths

• ```public class Maths
extends java.lang.Object```
A utility class that defines methods missing in java.lang.Mat
Author:
Marco
• ### Constructor Summary

Constructors
Constructor Description
`Maths()`
• ### Method Summary

All Methods
Modifier and Type Method Description
`static boolean` ```equal​(double d1, double d2)```
`static boolean` ```equal​(double d1, double d2, double difference)```
Tells if double numbers are equal.
`static long` `factorial​(int N)`
`double` `radianToDegree​(double radian)`
Convert an angle in radian unit to degree units
`static double` ```round​(double original, double precision)```
Round the full precision value at a given precision.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### Maths

`public Maths()`
• ### Method Detail

• #### equal

```public static boolean equal​(double d1,
double d2,
double difference)```
Tells if double numbers are equal. It is not a good practice to compare double directly, use if (Maths.equal(d1, d2) instead of if (d1 == d2).
Parameters:
`d1` - the 1st number
`d2` - the 2nd number
`difference` - (default value EPSILON)
Returns:
true if equal
• #### equal

```public static boolean equal​(double d1,
double d2)```
• #### factorial

`public static long factorial​(int N)`

`public double radianToDegree​(double radian)`
Convert an angle in radian unit to degree units
Parameters:
`radian` -
Returns:
angle in degree
• #### round

```public static double round​(double original,
double precision)```
Round the full precision value at a given precision. For instance, round(Math.PI, 0.01) gives 3.14
Parameters:
`original` - value
`precision` -
Returns:
rouned values