lib/bcmath.js
function bcsub(left_operand, right_operand, scale) {
    var first, second, result;

    if (typeof(scale) == 'undefined') {
        scale = libbcmath.scale;
    }
    scale   = ((scale < 0) ? 0 : scale);

    // create objects
    first   = libbcmath.bc_init_num();
    second  = libbcmath.bc_init_num();
    result  = libbcmath.bc_init_num();

    first   = libbcmath.php_str2num(left_operand.toString());
    second  = libbcmath.php_str2num(right_operand.toString());

    // normalize arguments to same scale.
    if (first.n_scale > second.n_scale) second.setScale(first.n_scale);
    if (second.n_scale > first.n_scale) first.setScale(second.n_scale);

    result  = libbcmath.bc_sub(first, second, scale);

    if (result.n_scale > scale) {
        result.n_scale = scale;
    }

    return result.toString();

}
function bcsub(left_operand, right_operand, scale) {
    var first, second, result;

    if (typeof(scale) == 'undefined') {
        scale = libbcmath.scale;
    }
    scale   = ((scale < 0) ? 0 : scale);

    // create objects
    first   = libbcmath.bc_init_num();
    second  = libbcmath.bc_init_num();
    result  = libbcmath.bc_init_num();

    first   = libbcmath.php_str2num(left_operand.toString());
    second  = libbcmath.php_str2num(right_operand.toString());

    // normalize arguments to same scale.
    if (first.n_scale > second.n_scale) second.setScale(first.n_scale);
    if (second.n_scale > first.n_scale) first.setScale(second.n_scale);

    result  = libbcmath.bc_sub(first, second, scale);

    if (result.n_scale > scale) {
        result.n_scale = scale;
    }

    return result.toString();

}
function bcsub ( left_operand , right_operand , scale ) { var first , second , result ; if ( typeof ( scale ) == 'undefined' ) { scale = libbcmath . scale ; } scale = ( ( scale < 0 ) ? 0 : scale ) ; // create objects first = libbcmath . bc_init_num ( ) ; second = libbcmath . bc_init_num ( ) ; result = libbcmath . bc_init_num ( ) ; first = libbcmath . php_str2num ( left_operand . toString ( ) ) ; second = libbcmath . php_str2num ( right_operand . toString ( ) ) ; // normalize arguments to same scale. if ( first . n_scale > second . n_scale ) second . setScale ( first . n_scale ) ; if ( second . n_scale > first . n_scale ) first . setScale ( second . n_scale ) ; result = libbcmath . bc_sub ( first , second , scale ) ; if ( result . n_scale > scale ) { result . n_scale = scale ; } return result . toString ( ) ; }
bcsub - Subtract one arbitrary precision number from another
Returns difference between the left operand and the right operand.

@param string left_operand       The left operand, as a string
@param string right_operand      The right operand, as a string.
@param int [scale]               The optional parameter is used to set the number of digits after the decimal place in the result. You can also set the global scale for all functions by using bcscale()
@return string
bcsub - Subtract one arbitrary precision number from another Returns difference between the left operand and the right operand .