Macro-processor: integer ranges with lower bound greater than upper bound are now empty (for consistency with MATLAB)

issue#70
Sébastien Villemot 2010-05-12 11:50:27 +02:00
parent fb5bf267d2
commit 64d9a38318
2 changed files with 1 additions and 7 deletions

View File

@ -325,12 +325,6 @@ IntMV::new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *m
int v2 = mv2i->value;
vector<int> result;
if (v2 < v1)
{
int x = v2;
v2 = v1;
v1 = x;
}
for (; v1 <= v2; v1++)
result.push_back(v1);
return new ArrayMV<int>(driver, result);

View File

@ -153,7 +153,7 @@ public:
//! Creates a integer range
/*! Arguments must be of type IntMV.
Returns an integer array containing all integers between mv1 and mv2.
If mv2 < mv1, constructs the range in decreasing order.
If mv2 < mv1, returns an empty range (for consistency with MATLAB).
*/
static const MacroValue *new_range(MacroDriver &driver, const MacroValue *mv1, const MacroValue *mv2) throw (TypeError);
};