Is it possible to get division by 0 (or infinity) in the following example?
public double calculation(double a, double
As a workaround, what about the following?
public double calculation(double a, double b) { double c = a - b; if (c == 0) { return 0; } else { return 2 / c; } }
That way you don't depend on IEEE support in any language.