View Single Post
Old 09-05-2020, 01:06 PM   #5
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,449
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by chaley View Post
The operators compare strings. If you want to compare numbers you will still need to use the cmp() function. You will also need to use strcmp() if you want < or >.
While improving performance I found I could add all the relational operators without a performance penalty. I also could add numeric relational ops, using slightly different operators. What will be there:
  • String (case insensitive): ==, !=, <, <=, >, >=
    String comparisons of numbers will use lexical ordering. For example, 11 < 2 is True.
  • Numeric: ==#, !=#, <#, <=#, >#, >=#
    Numeric comparison returns False if either left or right is non-numeric. Specifically, the empty string is not a number. For example, '' <# 1 is False

Last edited by chaley; 09-05-2020 at 04:28 PM. Reason: Improve comparison examples
chaley is offline   Reply With Quote