Solved

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

Posted on 2003-12-02
4
198 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
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…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now