Using the DEFAULT FloatToStr function
FloatToStr('0.0000442615029219009')
outputs
4.42615029219009E-5
dropping one zero after the decimal place
FloatToStr('0.000442615029219009')
produces
0.000442615029219009
Can someone please explain why the value in the second case is not output to
4.42615029219009E-4
The documentation for
FloatToStrcontains the answer:To interpret that statement you need also to refer to the topic describing the
Formatfunction, and specifically the text concerning the general number format (emphasis mine):Unfortunately the documentation is in fact in error there. Instead of
0.00001it should read0.0001. That this is illustrated by this program:For your examples,
0.0000442615029219009is less than0.0001and so is formatted using scientific notation. But0.000442615029219009is greater than0.0001and so gets formatted using fixed notation.If you want your output always to use scientific notation then use
Formatwith theeformat string.QC#107388