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)); }
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)); }
public void apply(UState state, UStack stack) { stack.push(stack.pop().neg()); }