Here you can find the source of add1(Double v1, Double v2)
public static Double add1(Double v1, Double v2)
//package com.java2s; import java.math.BigDecimal; public class Main { public static Double add1(Double v1, Double v2) { if (v1 == null) { v1 = 0d;// w w w. j a v a2 s .co m } if (v2 == null) { v2 = 0d; } double s1 = v1, s2 = v2; double v = add(s1, s2); if (v == 0) { return null; } return Double.valueOf(v); } public static double add(double v1, double v2) { BigDecimal b1 = new BigDecimal(Double.toString(v1)); BigDecimal b2 = new BigDecimal(Double.toString(v2)); return b1.add(b2).doubleValue(); } public static double add(Double v1, Double v2) { if (v1 == null) { v1 = 0d; } if (v2 == null) { v2 = 0d; } double s1 = v1, s2 = v2; return add(s1, s2); } }