We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using Doubles vs Decimals in XlsIO

Thread ID:





100650 Aug 22,2011 07:02 PM UTC Aug 23,2011 01:58 PM UTC ASP.NET Web Forms (Classic) 1
Tags: XlsIO
Administrator [Syncfusion]
Asked On August 22, 2011 07:02 PM UTC

I write accounting software and I never use doubles because of the precision and everyone says not to for money. I'm wondering if this is going to get me in trouble because the your Number is a double.

When I'm reading in to an object I create I use:
myDecimal = Convert.ToDecimal( sheet.Range[rowcount, 12].Number);

When I'm creating a sheet I use
worksheet.Range[rowcount, 2].Number = Convert.ToDouble(myDecimal);
worksheet.Range[rowcount, 2].NumberFormat = "$#,##0.00";

Should I be using number here? Since I'm only setting values, will I not get into trouble? If excel does calculations with the doubles will there be a problem?

Manikandan M [Syncfusion]
Replied On August 23, 2011 01:58 PM UTC

Hi Dan Parker,

Thank you for your interest in Syncfusion product.

Using Number format is correct. It would not create any problem if double value is stored in number format as you did. And Calculation can be done without any problem.



This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon