summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/wee-command.c11
-rw-r--r--src/core/wee-eval.c8
2 files changed, 12 insertions, 7 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index e4983cad7..7ddb0f3b3 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -7251,10 +7251,13 @@ command_init ()
"\n"
"An expression is considered as \"true\" if it is not NULL, not "
"empty, and different from \"0\".\n"
- "The comparison is made using integers if the two expressions are "
- "valid integers.\n"
- "To force a string comparison, add double quotes around each "
- "expression, for example:\n"
+ "The comparison is made using floating point numbers if the two "
+ "expressions are valid numbers, with one of the following formats:\n"
+ " - integer (examples: 5, -7)\n"
+ " - floating point number (examples: 5.2, -7.5, 2.83e-2)\n"
+ " - hexadecimal number (examples: 0xA3, -0xA3)\n"
+ "To force a string comparison, you can add double quotes around "
+ "each expression, for example:\n"
" 50 > 100 ==> 0\n"
" \"50\" > \"100\" ==> 1\n"
"\n"
diff --git a/src/core/wee-eval.c b/src/core/wee-eval.c
index e65fac78a..3c1952782 100644
--- a/src/core/wee-eval.c
+++ b/src/core/wee-eval.c
@@ -769,7 +769,7 @@ eval_compare (const char *expr1, int comparison, const char *expr2)
{
int rc, string_compare, length1, length2;
regex_t regex;
- long value1, value2;
+ double value1, value2;
char *error;
rc = 0;
@@ -816,12 +816,14 @@ eval_compare (const char *expr1, int comparison, const char *expr2)
if (!string_compare)
{
- value1 = strtol (expr1, &error, 10);
+ value1 = strtod (expr1, &error);
if (!error || error[0])
+ {
string_compare = 1;
+ }
else
{
- value2 = strtol (expr2, &error, 10);
+ value2 = strtod (expr2, &error);
if (!error || error[0])
string_compare = 1;
}