Posted By: Jethro
if comparison perform differently between Lite-c, C-Script. - 06/10/09 07:12
Just spent 4 weeks converting my 75,000 lines of C-script code base to Lite-c. and discovered the following, among many other things.
var This_Var;
This_Var=0.1;
if (This_Var==0.1){beep();}
The above works in C-script but not in Lite-C
vars are supposed to have an accuracy of 0.001, so why doesn't the above work in Lite-c.
To get it to work you need to make This_Var a float, to up the resolution of the comparison.
or do the comparison like this.
if (This_Var==floatv(0.1)) {beep();}
Is this a bug or a quirk with Lite-c var comparisons, having a much lower resolution than specified.
I put var This_Var in a panel digit and it does indeed keep its value of 0.100 so it does seem to be the comparison at fault.
Jethro.
var This_Var;
This_Var=0.1;
if (This_Var==0.1){beep();}
The above works in C-script but not in Lite-C
vars are supposed to have an accuracy of 0.001, so why doesn't the above work in Lite-c.
To get it to work you need to make This_Var a float, to up the resolution of the comparison.
or do the comparison like this.
if (This_Var==floatv(0.1)) {beep();}
Is this a bug or a quirk with Lite-c var comparisons, having a much lower resolution than specified.
I put var This_Var in a panel digit and it does indeed keep its value of 0.100 so it does seem to be the comparison at fault.
Jethro.