package com.knecon.fforesight.service.layoutparser.processor.docstrum.utils;

public class DoubleUtils {

    public static int compareDouble(double d1, double d2, double precision) {

        if (Double.isNaN(d1) || Double.isNaN(d2)) {
            return Double.compare(d1, d2);
        }
        long i1 = Math.round(d1 / (precision == 0 ? 1 : precision));
        long i2 = Math.round(d2 / (precision == 0 ? 1 : precision));
        return Long.compare(i1, i2);
    }

}
