Articles on Choosing the Best Numeric Data Type

G

Guest

Does anyone know of any articles that discuss the best practice for choosing a numeric data type. I remember seeing a good article in the past, but can't remember where. I am interested in articles that give advice when you should choose a 'Single', 'Double' or 'Decimal' and why. I am trying to push the idea that decimals should not be used everywhere, but I need articles supporting that position.
 
K

Klaus H. Probst

I don't see why you need an article.... unless you need the sheer size
(decimal) or the accuracy (double) you should just use single everywhere you
need a "real" number. Like everything else, this is a tradeoff between
performance and memory usage and the features that your code requires.


--
____________________
Klaus H. Probst, MVP
http://www.vbbox.com/



Brian said:
Does anyone know of any articles that discuss the best practice for
choosing a numeric data type. I remember seeing a good article in the past,
but can't remember where. I am interested in articles that give advice when
you should choose a 'Single', 'Double' or 'Decimal' and why. I am trying to
push the idea that decimals should not be used everywhere, but I need
articles supporting that position.
 
J

Jon Skeet [C# MVP]

Brian said:
Does anyone know of any articles that discuss the best practice for
choosing a numeric data type. I remember seeing a good article in the
past, but can't remember where. I am interested in articles that give
advice when you should choose a 'Single', 'Double' or 'Decimal' and
why. I am trying to push the idea that decimals should not be used
everywhere, but I need articles supporting that position.

I give a bit of advice in

http://www.pobox.com/~skeet/csharp/floatingpoint.html
and
http://www.pobox.com/~skeet/csharp/decimal.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top