static boolean approxEquals(double x, double y, double tolerance) {
        if (x == y) return true;
        if (Double.isNaN(x) && Double.isNaN(y)) return true;
        return Math.abs(x-y) < tolerance;
    }
Implemented here to make this work across implementations.
Implementations must override equals and call this because this is an interface and cannot override equals.
vespajlib/src/main/java/com/yahoo/tensor/Tensor.java