By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

Single or Double?

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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/de...tchPerfOpt.asp
--
Mike

Mike McIntyre
Visual Basic MVP
www.getdotnetcode.com

"John Dann" <ne**@prodata.co.uk> wrote in message
news:6s********************************@4ax.com...
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

Nov 21 '05 #2

P: n/a
John,

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

Cor

"John Dann" <ne**@prodata.co.uk>
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

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.