473,326 Members | 2,095 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Single or Double?

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
2 9707
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Simon Bunker | last post by:
I was just wondering why python doesn't make a distinction between single and double quotes - a bit like Perl does. Obviously I realise there are no dollar signs so you can't intrpolate a...
2
by: Diarmaid McGleenan | last post by:
Hi all. This isn't quite the same single/double-quote problem we see posted a multitude of times in this ng. Read on... I have a js function called ShowActiveLink which accepts a string...
5
by: Joel | last post by:
Hi, I incorporated a function in my code that whenever I use a string variable in an sql statement if the string contains a single quote it will encase it in double quotes else single quotes. ...
7
by: ma740988 | last post by:
I've got an unpacker that unpacks a 32 bit word into 3-10 bits samples. Bits 0 and 1 are dont cares. For the purposes of perfoming an FFT and an inverse FFT, I cast the 10 bit values into doubles....
6
by: G. | last post by:
This is an obvious bug in the String.Replace function: //load a XML string into a document XmlDocument doc = new XmlDocument(); doc.LoadXml("<test id='' />"); //Obtain the string...
4
by: Pieter | last post by:
Hi, I have a variable (m_sngPrixNetUnitaire) which is of type Single. When I want to write the value to my SQL SERVER 2000, I put this value in my DAL (MyDal.PrixNetUnitaire), which is of...
4
by: Justin Fancy | last post by:
Hi everyone, I need to replace all instances of a double quote(") with two single quotes('') in a text file. I already have some replacements of strings going on, but I tried this one, but the...
1
by: iaminsik | last post by:
Hi, I made a function prototype : <head> <script type="text/javascript"> function test (value) { alert (value); } </script> </head> Now, I hope to call it with quoted string like this :...
1
by: crimson08 | last post by:
does anyone know how to use radix sorting in a linked list???
1
by: eaocomp | last post by:
How do I trigger a single or double-click events when a user clicks a column within the gridview. I want the event to trigger and open a pop-up page related to the selected column. There are no...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.