var ish = ish || {};
ish.dspcalc = ish.dspcalc || {};
ish.dspcalc.funcs = ish.dspcalc.funcs || {};

ish.dspcalc.funcs.Abs = (function() {
    "use strict";

    return {
        name: 'abs',
        args: 1,
        func: function(tempStack, inStack) {
            var a = tempStack.peek();
            if (a === undefined) { throw new Error('Cannot take abs of nothing'); }
            if (a < 0) {
                tempStack.push(-1);
                inStack.push('*');
            }
        }
    };
})();