js/calc-model.js
/* Reverse the number sign positive negative of user input or result. */
Reverse the number sign positive negative of user input or result.
Reverse the number sign positive negative of user input or result .
function neg() {
    if (data.show !== data.accumulator) { 
        if (data.operands[data.cursor][0] !== '-') {
            data.operands[data.cursor].unshift('-');
        } else {
            data.operands[data.cursor].shift();
        }
    } else {
        data.accumulator *= -1;
        data.show = data.accumulator;
        if (data.operands[0]) data.operands[0] *= -1;
    }
}
function neg ( ) { if ( data . show !== data . accumulator ) { if ( data . operands [ data . cursor ] [ 0 ] !== '-' ) { data . operands [ data . cursor ] . unshift ( '-' ) ; } else { data . operands [ data . cursor ] . shift ( ) ; } } else { data . accumulator *= - 1 ; data . show = data . accumulator ; if ( data . operands [ 0 ] ) data . operands [ 0 ] *= - 1 ; } }
Reverse the number sign positive negative of user input or result.
Reverse the number sign positive negative of user input or result .
// data.show points to one of the operand