User Tools

Site Tools


2018numeric_cmp

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
2018numeric_cmp [2018/09/07 14:01]
david [Importance of Testing]
2018numeric_cmp [2018/09/07 14:01]
david [Correct Numeric Comparisons]
Line 11: Line 11:
 You must use the flag operators, or the symbolic operators inside double parentheses,​ to correctly compare values numerically. You must use the flag operators, or the symbolic operators inside double parentheses,​ to correctly compare values numerically.
 For example, say ''​a=2''​ and ''​b=10'': ​ For example, say ''​a=2''​ and ''​b=10'': ​
-  * <​nowiki>​[ ​$a -lt $b ]</​nowiki>​ is TRUE +  * <​nowiki>​[ ​-lt 10 ]</​nowiki>​ is TRUE 
-  * <​nowiki>​[[ ​$a -lt $b ]]</​nowiki>​ is TRUE +  * <​nowiki>​[[ ​-lt 10 ]]</​nowiki>​ is TRUE 
-  * <​nowiki>​[[ ​$a -ge $b ]]</​nowiki>​ is FALSE +  * <​nowiki>​[[ ​-ge 10 ]]</​nowiki>​ is FALSE 
-  * <​nowiki>​(( ​$a $b ))</​nowiki>​ is TRUE+  * <​nowiki>​(( ​10 ))</​nowiki>​ is TRUE
  
 ===== Incorrect Numeric Comparisons (lexicographic order) ===== ===== Incorrect Numeric Comparisons (lexicographic order) =====
2018numeric_cmp.txt · Last modified: 2018/09/07 14:02 by david