Skip to content

peterjohansen/math-damon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Math Damon

Immutable Java math library.

Examples

Ranges

IntegerRange range1 = new IntegerRange(5, 10);
System.out.println("Original: " + range1);
IntegerRange range2 = range1.shift(4);
System.out.println(" Shifted: " + range2);
System.out.println("Overlaps: " + range1.overlaps(range2));

...would output...

Original: IntegerRange[5, 10]
 Shifted: IntegerRange[9, 14]
Overlaps: true

Rational Numbers

Rational r1 = new Rational(2, 1);
Rational r2 = new Rational(1, 2);
System.out.println("     r1: " + r1);
System.out.println("     r2: " + r2);
System.out.println("r1 * r2: " + r1.multiply(r2));
System.out.println("r1 - r2: " + r1.subtract(r2));

...would output...

     r1: Rational[2/1]
     r2: Rational[1/2]
r1 - r2: Rational[3/2]
r1 * r2: Rational[1/1]

About

Immutable Java math library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages