View Single Post
 
Old 08-20-2009, 03:50 PM
dilettante's Avatar
dilettante dilettante is offline
Underclocked lifestyle

Forum Leader
* Guru *
 
Join Date: Feb 2005
Location: Michigan, USA
Posts: 4,518
Default

Just "for the record" (i.e. in case anybody tries to rely on this code) there were some bugs in the handling of Currency values as 64-bit integers. Another case of dumb mistakes introduced by copy/pasting to create a demo from a larger program.

For what it is worth consider this:
Quote:
A Note About Division
Any time you use the floating-point division operator (/), you're performing floating-point division, and your return value will be of type Double. This is true whether your dividend and divisor are integer, floating-point, or fixed-point values. It's true whether or not your result has a decimal portion.

For example, running the following code from the Immediate window prints "Double":

? TypeName(2.34/5.9)

So does this code, even though the result is an integer:

? TypeName(9/3)
So to scale a "byte number" (e.g. Byt = 1) as a Currency value use Byt * 0.0001@ rather than something like Byt / 10000@ which can lead to rounding error.
Attached Files
File Type: zip HugeFixed Demo.zip (10.5 KB, 27 views)
Reply With Quote