Solved

What is the number sign (#) after a number?

Posted on 2003-12-02
4
216 Views
Last Modified: 2010-05-01
I see a lot of 10#, 0#, etc., in VB code.  For example, Log(10#).  What does the postfixed "#" sign mean?
0
Comment
Question by:Niemand
  • 2
4 Comments
 
LVL 27

Expert Comment

by:Dabas
ID: 9861989
Hi Niemand,
From VB Help:

Double Data Type
     

Double (double-precision floating-point) variables are stored as IEEE 64-bit (8-byte) floating-point numbers ranging in value from -1.79769313486231E308 to -4.94065645841247E-324 for negative values and from 4.94065645841247E-324 to 1.79769313486232E308 for positive values. The type-declaration character for Double is the number sign (#).



Dabas
0
 

Author Comment

by:Niemand
ID: 9862232
Dabas,

I've read that under VB Help.  It doesn't seem relevant.  I'm not declaring any variables.  The number sign "#" comes right after a number.  In Log(10#), the number "10" is not a variable, is it?  In a line like:

Item = 0#

The number "0" is not a variable.
0
 
LVL 27

Accepted Solution

by:
Dabas earned 20 total points
ID: 9862270
Niemand,
When you write 10# you are forcing VB to store the number as a double.
I assume that 10 by itself will be stored as an integer (2 bytes)

If you do any calculations such as 10/5, the compiler will run a different routine than if you have 10#/5

Dabas
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9862292
You mostly see declarations like that where Option Explicit is not being used.  As Dabas has pointed out, the value or variable will be implicitly declared depending upon the character postfixed to it.

Idle_Mind
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

774 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question