floating point display errors?
Posted: Fri Mar 08, 2013 2:04 am
when attempting to display a simple fixed point number, the displayed number via log(); doesnt display correctly.
myfloat comes out as 1.09999 under the log(...f:myfloat); - Is this just an issue with displaying the value or does this affect a lot more than just displaying the number?
If this error comes up in more places it might explain as to why I've been having issues with capturing mouse coords after they've been converted to floating point numbers.
More than anything else, I've been running this just as a simple test to see if arrays can hold floating point numbers. It seems like they can, but I'm concerned about this display error. Can anyone provide any insight?
Code: Select all
int mytestarray[10];
Script 1 enter
{
int myfloat = 1.1;
int myint = 1;
int mycontrol = 1.0;
mytestarray[1] = myfloat;
mytestarray[2] = myint;
mytestarray[3] = mycontrol;
log(s:"myfloat - ", i:myfloat, s:" - ", f:myfloat);
log(s:"myint - ", i:myint, s:" - ", f:myint);
log(s:"mycontrol - ", i:mycontrol, s:" - ", f:mycontrol);
log(s:"testarray ints - ", i:mytestarray[1],s:" - ", i:mytestarray[2],s:" - ", i:mytestarray[3]);
log(s:"testarray floats - ", f:mytestarray[1],s:" - ", f:mytestarray[2],s:" - ", f:mytestarray[3]);
}
If this error comes up in more places it might explain as to why I've been having issues with capturing mouse coords after they've been converted to floating point numbers.
More than anything else, I've been running this just as a simple test to see if arrays can hold floating point numbers. It seems like they can, but I'm concerned about this display error. Can anyone provide any insight?