Single or Double?

  • Thread starter Thread starter John Dann
  • Start date Start date
J

John Dann

I'm retrieving some columns from a database with numeric values that
fall comfortably within the range of the Single type and I'm tempted
to use Single for the relevant column type in the retrieved dataset.
(Actually the values are held as integers in the database for compact
storage but are scaled to their true Single values during retrieval).

But I'm sure that I keep reading that there's no performance penalty
to using Double rather than Single as a type in VB.Net and that in
some senses the use of Single is on its way to being deprecated.
Actually I would have thought that for very large datasets - which I
might possibly encounter in this project - Single rather than Double
as a column type would make lower memory demands but maybe even this
isn't too important.

Anyone have any advice on whether I should just forget Single in
favour of Double or does Single still have its place?

JGD
 
John,

Quoting Gordon Brown from his "Performance Optimization in Visual Basic
..NET" article at MSDN:

From a performance standpoint, Double is best because the floating-point
processors of current platforms perform all operations in double precision.
Next best are Single and Decimal, in that order of efficiency.

See the commplete article at:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchPerfOpt.asp


--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com
 
John,

When Integer is sufficient than it is Integer.
Net is based at this moment on 32bits processor registers

Cor
 

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

Back
Top