Prohibited NaN steps.

This commit is contained in:
Evgeny Gerashchenko
2013-02-13 16:21:20 +04:00
parent 4043491ad2
commit 021496c07d
4 changed files with 18 additions and 0 deletions
+3
View File
@@ -25,6 +25,9 @@ public class DoubleProgression implements Progression<Double> {
private final double increment;
public DoubleProgression(double start, double end, double increment) {
if (Double.isNaN(increment)) {
throw new IllegalArgumentException("Increment must be not NaN");
}
if (increment == 0.0 || increment == -0.0) {
throw new IllegalArgumentException("Increment must be non-zero: " + increment);
}
+3
View File
@@ -25,6 +25,9 @@ public class FloatProgression implements Progression<Float> {
private final float increment;
public FloatProgression(float start, float end, float increment) {
if (Float.isNaN(increment)) {
throw new IllegalArgumentException("Increment must be not NaN");
}
if (increment == 0.0f || increment == -0.0f) {
throw new IllegalArgumentException("Increment must be non-zero: " + increment);
}