List of usage examples for org.apache.commons.math3.fraction Fraction Fraction
public Fraction(int num)
From source file:unikl.disco.misc.NumberObj.java
public NumberObj() { switch (type) { case DOUBLE:/*from w ww . ja va 2s. c om*/ this.value = new Double(0.0); break; case RATIONAL: this.value = new Fraction(0.0); break; default: } }
From source file:unikl.disco.misc.NumberObj.java
public NumberObj(double value) { switch (type) { case DOUBLE:/*from w ww. j av a 2 s . co m*/ this.value = new Double(value); break; case RATIONAL: this.value = new Fraction(value); break; default: System.exit(0); } }
From source file:unikl.disco.misc.NumberObj.java
private static NumberObj getNaN() { switch (type) { case DOUBLE:/*from w ww. j av a2 s . c om*/ return new NumberObj(Double.NaN); case RATIONAL: return new NumberObj(new Fraction(Double.NaN)); default: return null; } }
From source file:unikl.disco.misc.NumberObj.java
private static NumberObj getPosInfinity() { switch (type) { case DOUBLE:/*from w ww .j av a 2 s.c om*/ return new NumberObj(Double.POSITIVE_INFINITY); case RATIONAL: // Fraction is based in Integer and thus there's no infinity (and it is prone to overflows) return new NumberObj(new Fraction(Integer.MAX_VALUE)); default: return null; } }
From source file:unikl.disco.misc.NumberObj.java
private static NumberObj getNegInfinity() { switch (type) { case DOUBLE:// www. j a v a2s.c o m return new NumberObj(Double.NEGATIVE_INFINITY); case RATIONAL: // Fraction is based in Integer and thus there's no infinity (and it is prone to overflows) return new NumberObj(new Fraction(Integer.MIN_VALUE)); default: return null; } }
From source file:unikl.disco.numbers.NumFraction.java
public NumFraction(double value) { this.value = new Fraction(value); checkInftyNaN(); }
From source file:unikl.disco.numbers.NumFraction.java
public NumFraction(String num_str) throws Exception { if (num_str.equals("Infinity")) { value = POSITIVE_INFINITY.value; } else {// w ww . j ava 2 s.com value = new Fraction(Num.parse(num_str).doubleValue()); checkInftyNaN(); } }
From source file:unikl.disco.numbers.NumFraction.java
public NumFraction(int num) { value = new Fraction(num); checkInftyNaN(); }
From source file:unikl.disco.numbers.NumFraction.java
private void instantiatePositiveInfinity() { value = new Fraction(Integer.MAX_VALUE); isNaN = false; isPosInfty = true; isNegInfty = false; }
From source file:unikl.disco.numbers.NumFraction.java
private void instantiateNegativeInfinity() { value = new Fraction(Integer.MIN_VALUE); isNaN = false; isPosInfty = false; isNegInfty = true; }