I pass some parameters in float format from C# script to the shader. I load the number from a text file, most of the number is in exponential format. The precision was terribly lost in the procedure:
float a = float.Parse(line, System.Globalization.NumberStyles.Float );
line is a string.
For example, the data loaded from the text is -1.86666E-008. It will become -1.86666E-08 after the parsing!
I found the things went wrong are not the numbers go with exponential, but 2 “integer” numbers stored in float. They will be corrected if I directly assign the value, yet go wrong if I load them from text. Need to figure it out.
Originally I define those floating number (with exponential) in shader, then move them to C# script. The result was indeed different and the ones in C# got better precision.