Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2003-12-02
4
Medium Priority
?
245 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 80 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 86

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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

926 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