problem of values with scientific notation RRS feed

  • Question

  • User-1825561198 posted



    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?

    Thank you

    Friday, September 9, 2016 3:22 PM

All replies

  • User36583972 posted

    Hi urpalshu,

    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.

    Best Regards,

    Yohann Lu

    Monday, September 12, 2016 8:17 AM
  • User303363814 posted

    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?

    Monday, September 12, 2016 11:59 PM