Class DoubleCompare
java.lang.Object
nl.tudelft.simulation.dsol.formalisms.devs.esdevs.DoubleCompare
DoubleCompare class. Compares two doubles except for the last two bits of the mantissa.
Copyright (c) 2009-2024 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://simulation.tudelft.nl. The DSOL project is distributed under a three-clause BSD-style license, which can be found at https://https://simulation.tudelft.nl/dsol/docs/latest/license.html.
- Author:
- Mamadou Seck
-
Method Summary
-
Method Details
-
compare
public static int compare(double d1, double d2) Fuzzy compare of two double variables. When they differ less than 4 ulps, that they are equal.- Parameters:
d1
- double; the first double to compared2
- double; the second double to compare- Returns:
- 0 if (almost) equal, -1 of d1 < d2, and 1 if d1 > d2.
-
main
Test.- Parameters:
args
- String[]; empty
-