Here you can find the source of equals(float f1, float f2)
public static boolean equals(float f1, float f2)
//package com.java2s; /**/*from ww w. jav a 2 s .co m*/ * This file is protected by Copyright. * Please refer to the COPYRIGHT file distributed with this source distribution. * * This file is part of REDHAWK IDE. * * All rights reserved. This program and the accompanying materials are made available under * the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html. * */ import java.util.Arrays; public class Main { /** * @since 1.2 */ public static boolean equals(final Object left, final Object right) { if (left == right) { return true; } else if (left == null) { return false; } else { if (right == null) { return false; } else if (left.getClass() != right.getClass()) { return false; } else if (left instanceof Object[]) { return Arrays.deepEquals((Object[]) left, (Object[]) right); } else if (left instanceof byte[]) { return Arrays.equals((byte[]) left, (byte[]) right); } else if (left instanceof char[]) { return Arrays.equals((char[]) left, (char[]) right); } else if (left instanceof short[]) { return Arrays.equals((short[]) left, (short[]) right); } else if (left instanceof int[]) { return Arrays.equals((int[]) left, (int[]) right); } else if (left instanceof long[]) { return Arrays.equals((long[]) left, (long[]) right); } else if (left instanceof float[]) { return Arrays.equals((float[]) left, (float[]) right); } else if (left instanceof double[]) { return Arrays.equals((double[]) left, (double[]) right); } else if (left instanceof boolean[]) { return Arrays.equals((boolean[]) left, (boolean[]) right); } else { return left.equals(right); } } } /** * @since 3.3 */ public static boolean equals(float f1, float f2) { return Math.abs(f1 - f2) < 0.0000001f; } /** * @since 3.3 */ public static boolean equals(double d1, double d2) { return Math.abs(d1 - d2) < 0.0000001d; } }