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.
Unfortunately, activation email could not send to your email. Please try again.

Using Doubles vs Decimals in XlsIO

Thread ID:





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

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 09:58 AM

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.

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.