compute maxD: short-circuit unnecessary exp calls