Java tutorial
//package com.java2s; //License from project: Open Source License import java.math.BigDecimal; public class Main { public static Double sub(Double v1, Double v2) { BigDecimal b1 = new BigDecimal(v1.toString()); BigDecimal b2 = new BigDecimal(v2.toString()); return Double.valueOf(b1.subtract(b2).doubleValue()); } }