private double getExtremumOfLog(double x, double y, Function func) {
        if (x == 0 || isNaN(x)) {
            if (y == 0 || isNaN(y)) return NaN;
            return log10(y);
        }
        if (y == 0 || isNaN(y)) return log10(x);
        return func.apply(log10(x), log10(y));
    }