Class FloatingPointUtil

java.lang.Object
org.mapfish.print.FloatingPointUtil

public final class FloatingPointUtil extends Object
Util class to test equality of floating points.
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    equals(double d1, double d2)
    Check the equality of two doubles taking into consideration the precision issue of floating point arithmetic in Java.
    static boolean
    equals(float f1, float f2)
    Check the equality of two floats taking into consideration the precision issue of floating point arithmetic in Java.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • equals

      public static boolean equals(float f1, float f2)
      Check the equality of two floats taking into consideration the precision issue of floating point arithmetic in Java.
      Parameters:
      f1 - Float 1.
      f2 - Float 2.
    • equals

      public static boolean equals(double d1, double d2)
      Check the equality of two doubles taking into consideration the precision issue of floating point arithmetic in Java.
      Parameters:
      d1 - Double 1.
      d2 - Double 2.