Overview
| Artifact ID: | 5461560ec6ad9049876a70c1e786f49b04f240e9342504a483778ab7a3086ad7 |
|---|---|
| Ticket: | aa69bce71e214872af462de3a3050a46eec61385
expr comparison operator result does not follow the documentation |
| User & Date: | anonymous on 2024-03-11 21:26:09 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-plain"
- comment changed to:
I wanted to know if the 'expr' command when using the < operator compares its arguments as numbers or as strings. So I checked the documentation for expr. This is what it says: >> These operators may be applied to strings as well as numeric operands, in which case string comparison is used. << https://tcl.tk/man/tcl/TclCmd/expr.htm#M12 From this, I expect that I can compare two string, or I can compare two numbers, both will be ok for the operator. It should always compare as strings - as it says that strig comparison is used. But the implementation does not follow it % expr {12<2} 0 % expr {"12"<"2"} 0 When compared as strings the first should be smaller than the second. The result should be 1. The string comparison should be like this: % string compare 12 2 -1 I.e. the first string is less than the second. Or maybe the documentation is wrong? - foundin changed to: "8.6"
- is_private changed to: "0"
- login: "anonymous"
- priority changed to: "5 Medium"
- private_contact changed to: "eb1592a11067c658ae62686070571429a9282829"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "anonymous"
- subsystem changed to: "16. Commands A-H"
- title changed to:
expr comparison operator result does not follow the documentation
- type changed to: "Bug"