Examples of BigDec


Examples of lipstone.joshua.parser.types.BigDec

  private ArrayList<BigDec> getRoots(ConsCell equation) throws ParserException {
    ArrayList<BigDec> roots = new ArrayList<BigDec>();
    ArrayList<ConsCell> terms = getTerms(equation);
    if (terms.size() < 1)
      return roots;
    BigDec highestCo = getCoefficient(terms.get(0)), lowestCo = getCoefficient(terms.get(terms.size() - 1));
    if (!highestCo.isInt()) {
      lowestCo = lowestCo.divide(highestCo);
      highestCo = BigDec.ONE;
      if (!lowestCo.isInt())
        return roots;
    }
    if (!lowestCo.isInt()) {
      highestCo = highestCo.divide(lowestCo);
      lowestCo = BigDec.ONE;
      if (!highestCo.isInt())
        return roots;
    }
   
    ArrayList<BigDec> aN = findFactors(highestCo), a0 = findFactors(lowestCo);
    for (BigDec i : a0)
      for (BigDec a : aN) {
        if (new BigDec(i).divide(new BigDec(a)).getInfinity() != 0)
          continue;
        roots.add(new BigDec(i).divide(new BigDec(a)));
        roots.add(new BigDec(i).divide(new BigDec(a)).multiply(BigDec.MINUSONE));
      }
    return roots;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.