Package lipstone.joshua.parser.types

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


        String[] unit = stripPrefix((String) current.getCar());
        partial = this.units.get(unit[1]).getFactor();
        if (partial == null)
          throw new InvalidUnitException(current.getCar() + " is not a valid unit.", nl);
        if (unit[0].length() > 0)
          partial = partial.multiply(prefixes.get(unit[0]));
      }
      else if (current.getCarType() == ConsType.CONS_CELL) {
        ConsCell fact = parser.run(parser.preProcess((ConsCell) current.getCar()));
        if (fact.getCarType() != ConsType.NUMBER || fact.length() != 1)
          throw new InvalidUnitException(current.getCar() + " is not a valid unit set.", nl);
View Full Code Here


                current.getNextConsCell().remove();
              }
              output = num1.pow(num2);
            }
            else if (operator == '*')
              output = num1.multiply(num2);
            else if (operator == '/')
              output = num1.divide(num2);
            else if (operator == '+')
              output = num1.add(num2);
            else if (operator == '-')
View Full Code Here

    ArrayList<BigDec> answers = new ArrayList<BigDec>();
    while (answers.size() == 0) {
      for (BigDec answer : stepSolveDomain(equation, xMin, xMax, delta))
        answers.add(answer);
      if (xMin.gteq(BigDec.ZERO))
        xMin = xMin.add(xMax.multiply(new BigDec(2)));
      xMin = xMin.multiply(BigDec.MINUSONE);
    }
    return answers;
  }
 
View Full Code Here

        eqn = eqn.getFirstConsCell();
        if (parser.containsVariables(eqn, vars))
          continue;
        eqn = parser.run(eqn);
        if (eqn.length() == 1 && eqn.getCarType() == ConsType.NUMBER)
          coefficient = divide ? coefficient.divide((BigDec) eqn.getCar()) : coefficient.multiply((BigDec) eqn.getCar());
      }
    } while (!(current = current.getNextConsCell()).isNull());
    return negative ? coefficient.multiply(BigDec.MINUSONE) : coefficient;
  }
 
View Full Code Here

        eqn = parser.run(eqn);
        if (eqn.length() == 1 && eqn.getCarType() == ConsType.NUMBER)
          coefficient = divide ? coefficient.divide((BigDec) eqn.getCar()) : coefficient.multiply((BigDec) eqn.getCar());
      }
    } while (!(current = current.getNextConsCell()).isNull());
    return negative ? coefficient.multiply(BigDec.MINUSONE) : coefficient;
  }
 
  /**
   * Gets the segments within a term, where the segments are separated by * or / signs.
   *
 
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.