Browse Source

param.JasFunctionFactory.fromBigRational: handle special values directly

Before, the special values (Inf, -Inf, NaN) where implicitly passed
to JAS, now we just return the corresponding static singletons.
accumulation-v4.7
Joachim Klein 6 years ago
parent
commit
004424bd31
  1. 11
      prism/src/param/JasFunctionFactory.java

11
prism/src/param/JasFunctionFactory.java

@ -133,6 +133,17 @@ final class JasFunctionFactory extends FunctionFactory {
@Override @Override
public Function fromBigRational(BigRational from) { public Function fromBigRational(BigRational from) {
if (from.isSpecial()) {
if (from.isInf())
return getInf();
else if (from.isMInf())
return getMInf();
else if (from.isNaN())
return getNaN();
else
throw new RuntimeException("Implementation error");
}
Quotient<BigInteger> result = jasQuotRing.fromInteger(from.getNum()); Quotient<BigInteger> result = jasQuotRing.fromInteger(from.getNum());
Quotient<BigInteger> den = jasQuotRing.fromInteger(from.getDen()); Quotient<BigInteger> den = jasQuotRing.fromInteger(from.getDen());
result = result.divide(den); result = result.divide(den);

Loading…
Cancel
Save