Examples of toFraction()


Examples of lipstone.joshua.parser.types.BigDec.toFraction()

    if (orderOfEquation(equation, parser.getVars()).lt(new BigDec(2)))
      return equation;
    ArrayList<ConsCell> eqn = foldSigns(getTerms(equation));
    BigDec highestCoefficient = getCoefficient(eqn.get(0)), lowestCoefficient = getCoefficient(eqn.get(eqn.size() - 1)), lcm = BigDec.ONE;
    if (!highestCoefficient.isInt() || !lowestCoefficient.isInt()) {
      lcm = ((BigDec) highestCoefficient.toFraction().getCar(2)).lcm((BigDec) lowestCoefficient.toFraction().getCar(2));
      equation = eqn.get(0).getLastConsCell().append(new ConsCell('*', ConsType.OPERATOR, new ConsCell(lcm, ConsType.NUMBER)));
      for (int i = 0; i < eqn.size(); i++)
        equation = equation.append(new ConsCell('+', ConsType.OPERATOR, eqn.get(i).getLastConsCell().append(new ConsCell('*', ConsType.OPERATOR, new ConsCell(lcm, ConsType.NUMBER))).getFirstConsCell().clone()));
      equation = equation.getFirstConsCell();
      equation = simplifyTerms(parser.removeDoubles(equation));
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.