Overview
| Artifact ID: | 47773e6aad43d1f8145827bc3c3f08f09a149d5c |
|---|---|
| Ticket: | ef5373e6fa0617ee02f201c6c8f41746678c5afb
expr, literal numeric values, and string comparisons |
| User & Date: | pooryorick on 2016-10-03 22:17:53 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
The documentation for <code>expr</code> provides seven rules for operand syntax. Of those, the value <code>0x12</code> matches rule 1, and only rule 1: "... a numeric value, either integer or floating-point". Therefore, <code>0x12</code> is unambiguously a numeric value. The string representation of <code>0x12</code> is <code>18</code>, as illustrated by the result of <code>[expr 0x12]</code>. Furthermore, the documentation states that operands that are not numeric or boolean must be quoted. It's well-accepted that only numeric operands can appear unquoted in an expression. Finally, the documentation states that in order to compare a numeric operand to an operand that can't be interpreted as numeric, the string representation for the numeric operand is generated. Consider <code><verbatim> expr {{0y} > 0x12} </verbatim></code> . Since <code>0x12<code> is numeric, and its string representation is <code>18</code>, the previous command should produce the same result as <code><verbatim> expr {{0y} > {18}} </verbatim></code> . However, this isn't the case. The result of the first command is `1`, and the result of the second is `0`. - foundin changed to: "8.5"
- is_private changed to: "0"
- login: "pooryorick"
- priority changed to: "5 Medium"
- private_contact changed to: "4403a7f74e8fccbce1943bdd674d5d936b16d5b8"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "pooryorick"
- subsystem changed to: "16. Commands A-H"
- title changed to:
expr, literal numeric values, and string comparisons
- type changed to: "Bug"