Last post Sep 12, 2016 11:59 PM by PaulTheSmith
Sep 09, 2016 03:22 PM|urpalshu|LINK
We have values like “-5.6843418860808E-14“ saved in the database.
One of the services we have sends values w/ scientific notation to be inserted.
could there be a generic solution to fix the problem of values with scientific notation. A generic solution to be used in different projects.
I´m not sure if we should create a specific method to handle those situations, In my opinion the best solution is to use a MATH.ROUND. The decimal digits to use will be chosen based on the needs.
Replace the following code:
SSCustBal = this.ReadDoubleColumn(SSCustBalanceReader, “Balance00”);
SSCustBal = Math.Round(this.ReadDoubleColumn(SSCustBalanceReader, “Balance00”),3);
Please let me know your suggestions?
Sep 12, 2016 08:17 AM|Yohann Lu|LINK
According to your description, if you want to convert the data（scientific notation ）into the form of retaining three decimal , Math.Round is a good way to achieve this requirement.
If my understanding is incorrect, please describe your needs in detail, such as your original data, want to convert the type of data, and what operation that you want.
Sep 12, 2016 11:59 PM|PaulTheSmith|LINK
What is the problem? You have told us that something is stored in the database - why is that a problem? You have told us that you receive values from a service - why is that a problem?
What is the data type in the database? Which database? What is the datatype of the values coming from the service?