Exemple #1
0
 public void apply(UState state, UStack stack) {
   UNumber x = stack.pop();
   if (!(x instanceof UnitNum)) {
     x = new UnitNum(x, state.angleUnit);
   }
   stack.push(UMath.tan(x));
 }
Exemple #2
0
  public void apply(UState state, UStack stack) {
    UNumber x = stack.pop();
    UNumber y = stack.pop();
    Unit to = (x instanceof UnitNum) ? ((UnitNum) x).unit : Unit.NONE;
    Unit from;

    if (y instanceof UnitNum) {
      from = ((UnitNum) y).unit;
      y = ((UnitNum) y).value;
    } else {
      from = Unit.NONE;
    }

    stack.push(new UnitNum(to.from(y, from), to));
  }
Exemple #3
0
 public void apply(UState state, UStack stack) {
   stack.push(stack.pop().neg());
 }