|Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder Components » View Thread|
|Messages 1 to 2 of 2 total|
|FloatToStr and scientific notation|
|Sun, Aug 19 2018 11:59 AM||Permanent Link|
I need to display very small numbers using scientific notation to only three decimal places:
e.g., display 0.00000000000325394873638... as '3.254e-12'.
FloatToStr will return a string in scientific notation when the number is very small. However, the coefficient will have 17 or so decimal places before getting to the exponential portion: e.g., 'e-12'. This fills up the output edit component, making it look like the result is 3.25394873638... . I can scroll over to the e-12, but to the user it looks as though the answer is 3.2539....
Limiting the number of decimals places to 3 does not work when FloatToStr decides to use scientific notation. I get instead 0.000 rather than 3.254e-12.
One solution is to have a ridiculously wide edit box, which does not look good.
1. Is there a way to force the FloatToStr output string to be in scientific notation?
2. If the answer is yes, is there any way to limit the number of decimal places?
|Tue, Aug 21 2018 2:03 PM||Permanent Link|
Tim Young [Elevate Software]
Elevate Software, Inc.
<< Limiting the number of decimals places to 3 does not work when FloatToStr decides to use scientific notation. I get instead 0.000 rather than 3.254e-12. >>
This is because FloatToStr with specified decimal places causes rounding, and that value is rounded to 0.000.
<< 1. Is there a way to force the FloatToStr output string to be in scientific notation? >>
No, not at this time. I can certainly add a new function for this. I'll also need to add a dataset column property for specifying whether one wants data displayed in scientific format (or not).
As a workaround, if you do something like this:
with a value of '0.00000000000325394873638', it *will* serve to convert the number into scientific format. However, you can't explicitly limit the number of decimal places.