Can anyone explain the logic here?
So testing out number comparison using STRING$() instead of the very limited VAL() function. What i discovered is string$() comparison does a great job, even on very large numbers, decimals included, until you get to comparing two negative string numbers. Note in the last comparison the string evaluation is true and should be false for [-11.2 > -11.1] as it is in the numeric variable comparison.
Pete
Code: (Select All)
a$ = "11.2": b$ = "11.1": PRINT a$ > b$, 11.2 > 11.1 ' Both True - Okay
a$ = "-11.2": b$ = "11.1": PRINT a$ > b$, -11.2 > 11.1 ' Both False - Okay
a$ = "11.2": b$ = "-11.1": PRINT a$ > b$, 11.2 > -11.1 ' Both True - Okay
a$ = "-11.2": b$ = "-11.1": PRINT a$ > b$, -11.2 > -11.1 ' [True (Error)] / False NOT Okay
So testing out number comparison using STRING$() instead of the very limited VAL() function. What i discovered is string$() comparison does a great job, even on very large numbers, decimals included, until you get to comparing two negative string numbers. Note in the last comparison the string evaluation is true and should be false for [-11.2 > -11.1] as it is in the numeric variable comparison.
Pete