472,790 Members | 3,568 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,790 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 9664
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: Rina0 | last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.