As I have mentioned many times previously, I'm trying to "replace" C++ programs by batch files whenever possible, and I had a need to do some relatively simple numeric calculations. Well, the .btm file I was writing did a comparison of one numeric value to another in a "if" statement, and I was not getting the results I expected. So, after quite a bit of experimentation, I was able to reduce it to the following (note that no batch file is involved):
As you can see if you examine the above closely, a "straight" comparison in an "If" statement does not work beyond 10 digits of precision (in TCMD.INI, EvalMax=14), and an expression involving @Eval does not work at all if the right operand is 0 and the left argument is a fractional value. (Although, as you can also see, comparing 0 to 1 gives the expected result.)
So to be complete about it, I did the same thing under version 12.11.74, and just to see if there was any change in version 13, I repeated things in (my trial version of) 13.00.23, again with the same results. (And "EvalMax" is "14" in all cases.) Just so there is no doubt about any of this, attached to this posting is a zip file containing the files produced by the "Save to File..." menu option for all three versions of TCC.
HTML:
[Z:\]ver
TCC 12.11.76 Windows 7 [Version 6.1.7601]
[Z:\]If .75647374412 LT .75647374413 Echo Less Than
[Z:\]If .5647374412 LT .5647374413 Echo Less Than
Less Than
[Z:\]Echo %@Eval[.5647374412<.5647374413]
0
[Z:\]Echo %@Eval[0<.1]
0
[Z:\]Echo %@Eval[0LT.1]
TCC: Syntax error "0LT.1"
[Z:\]Echo %@Eval[0<1]
1
[Z:\]
So to be complete about it, I did the same thing under version 12.11.74, and just to see if there was any change in version 13, I repeated things in (my trial version of) 13.00.23, again with the same results. (And "EvalMax" is "14" in all cases.) Just so there is no doubt about any of this, attached to this posting is a zip file containing the files produced by the "Save to File..." menu option for all three versions of TCC.