Code example for BigDecimal

Methods: doubleValuesubtract

0
        deciSum = deciSum.add( new BigDecimal(in) );
    } 
 
    public double getSum() { 
        log.info("Got BigDecimal "+deciSum+" v. double " + sum );
        BigDecimal diff = deciSum.subtract(new BigDecimal(sum));
        if( diff.doubleValue() != 0.0 ) {
            log.severe("Kahan summation disagrees with BigDecimal by "+diff);
        } 
        return sum;
    } 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE