Allow negative step with range
diff --git a/generic/THTensorMath.c b/generic/THTensorMath.c
index 1a675f7..270a89e 100644
--- a/generic/THTensorMath.c
+++ b/generic/THTensorMath.c
@@ -658,8 +658,8 @@
long size;
real i = 0;
- THArgCheck(step > 0, 3, "step must be a positive number");
- THArgCheck(xmax > xmin, 2, "upper bound must be larger than lower bound");
+ THArgCheck(step > 0 || step < 0, 3, "step must be a non-null number");
+ THArgCheck((step > 0) && (xmax > xmin) || (step < 0) && (xmax < xmin), 2, "upper bound and larger bound incoherent with step sign");
size = (long)((xmax-xmin)/step+1);