Exclamation Point attached to variable name
Exclamation Point attached to variable name
(OP)
I saw something in someone else's code--an exclamation point at the end of a variable name. I was unfamiliar with the usage, looked it up, read that the exclamation point is used to specify a variable as precision Single.
Usage: "dummy!" will make the variable "dummy" a Single precision variable.
Why would someone use the exclamation point? Why not just make all floating point (real) variables Double precision?
Usage: "dummy!" will make the variable "dummy" a Single precision variable.
Why would someone use the exclamation point? Why not just make all floating point (real) variables Double precision?
RE: Exclamation Point attached to variable name
btw # evokes double. However, the characters are not parsed by VBA. You declare type using Dim. The appended characters are for the programmer to keep track of types.
TTFN
FAQ731-376: Eng-Tips.com Forum Policies
RE: Exclamation Point attached to variable name
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: Exclamation Point attached to variable name
CODE
Dummy1! = (Application.WorksheetFunction.Pi())
Dummy2# = (Application.WorksheetFunction.Pi())
Dummy1! = Dummy1! * 1E+17
Dummy2# = Dummy2# * 1E+17
Debug.Print Dummy1! - Dummy2#
End Sub
157376256
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: Exclamation Point attached to variable name
But, if you have a large program computationally intensive program with lots of variables, I believe you can save memory and speed execution by using single vs double if you don't need the extra accuracy. That was probably more important in the old days. Hard to imagine there are many practical cases when it makes a big difference anymore.
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: Exclamation Point attached to variable name
=====================================
Eng-tips forums: The best place on the web for engineering discussions.
RE: Exclamation Point attached to variable name
RE: Exclamation Point attached to variable name
RE: Exclamation Point attached to variable name
TTFN
FAQ731-376: Eng-Tips.com Forum Policies