Here you can find the source of doubleEquals(Double d1, Double d2)
Parameter | Description |
---|---|
d1 | first double |
d2 | second double |
public static boolean doubleEquals(Double d1, Double d2)
//package com.java2s; /*/*from ww w . ja va 2 s.c o m*/ * Copyright (c) Interactive Information R & D (I2RD) LLC. * All Rights Reserved. * * This software is confidential and proprietary information of * I2RD LLC ("Confidential Information"). You shall not disclose * such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered * into with I2RD. */ public class Main { /** * Check if the two Double values are equal by checking that the absolute value between them is less than 0.01 * * @param d1 first double * @param d2 second double * * @return boolean, if true, the doubles are equal */ public static boolean doubleEquals(Double d1, Double d2) { return Math.abs(d1 - d2) <= 0.01; } }