Java Double Number Equal doubleEquals(double a, double b)

Here you can find the source of doubleEquals(double a, double b)

Description

Implements the semantics of Double#equals(Object) for two primitive doubles.

License

Open Source License

Parameter

Parameter Description
a double-precision value
b double-precision value

Return

true if equal, false if not

Declaration

public static boolean doubleEquals(double a, double b) 

Method Source Code

//package com.java2s;
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

public class Main {
    /**/*from   w  w w. jav  a 2  s.  c o m*/
     * Implements the semantics of {@link Double#equals(Object)} for two
     * primitive doubles.
     *
     * @param a double-precision value
     * @param b double-precision value
     * @return true if equal, false if not
     */
    public static boolean doubleEquals(double a, double b) {
        return Double.doubleToLongBits(a) == Double.doubleToLongBits(b);
    }
}

Related

  1. doubleEqual(double d1, double d2, double delta)
  2. doubleEqual(double v1, double v2)
  3. doubleEquality(double v1, double v2, double epsilon)
  4. doubleEquals(double a, double b)
  5. doubleEquals(double a, double b)
  6. doubleEquals(Double d1, Double d2)
  7. doubleEquals(double d1, double d2)
  8. doubleEquals(double d1, double d2, double epsilon)
  9. doubleEqualsWithTolerance(double a, double b, long maxFloatsBetween)