Commit 8d65298d authored by Jody Goldberg's avatar Jody Goldberg

Match MS Excel's comparison priorities.

all boolean values > any number.

This seems like a questionable choice on their part, but we'll play along
for now.
parent 5e959f99
......@@ -4,6 +4,9 @@
1999-08-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real): Fix bool <-> number comparisons to match
excel approach. TRUE&FALSE > numbers.
* src/item-bar.c (item_bar_event) : Button3 should select the
current row/col before bringing up the edit menu.
......
......@@ -4,6 +4,9 @@
1999-08-02 Jody Goldberg <jgoldberg@home.com>
* src/expr.c (eval_expr_real): Fix bool <-> number comparisons to match
excel approach. TRUE&FALSE > numbers.
* src/item-bar.c (item_bar_event) : Button3 should select the
current row/col before bringing up the edit menu.
......
......@@ -709,6 +709,12 @@ compare (const Value *a, const Value *b)
}
}
/* Booleans > all numbers (Why did excel do this ??) */
if (ta == VALUE_BOOLEAN && (tb == VALUE_INTEGER || tb == VALUE_FLOAT))
return IS_GREATER;
if (tb == VALUE_BOOLEAN && (ta == VALUE_INTEGER || ta == VALUE_FLOAT))
return IS_LESS;
switch ((ta > tb) ? ta : tb) {
case VALUE_EMPTY: /* Empty Empty compare */
return IS_EQUAL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment