Learn about VB6's Currency data type
Takeaway: Visual Basic 6's Currency data type is specifically designed to hold data that represents money amounts. Discover several advantages to using the Currency data type.
Many VB6 programmers automatically use the Single data type for holding data that represents money amounts. You should be aware that the Currency data type is, as the name implies, specially designed for this purpose and offers some advantages.
Currency is a fixed-point data type, as opposed to the floating-point Single. In other words, it is always accurate to a specific number of decimal places, four in this case. While the Single type can represent many more decimal places, these are not needed in Currency calculations and, in fact, can introduce rounding errors. These errors are small but can have an effect on overall accuracy.
The Currency data type is actually an integer type internally. In use, it is scaled by a factor of 10,000 to give four digits to the right of the decimal point. It permits up to 15 digits to the left of the decimal point, resulting in a range of approximately -922,337,000,000,000 to +922,337,000,000,000. An individual type Currency variable takes up 8 bytes of memory, compared to 4 bytes for Single.
Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!
White Papers, Webcasts, and Downloads
- VMware Infrastructure: A Guide to Bottom-Line Benefits VMware Frustrated by the high cost of maintaining or building ever-larger data centers? Get the facts you need to formulate your Virtualization Action Plan. Download Now
- Why Isn't Server Virtualization Saving Us More? A Few Small Changes May Dramatically Increase Your Efficiency VMware Ever wonder why your company isn't saving more from its server virtualization? Making a few small changes could dramatically increase your efficiency. Download Now
- Building the Virtualized Enterprise with VMware Iinfrastructure VMware VMware virtualization software has been adopted by over 120,000 enterprise ... Download Now
- Email Security and Archiving - Clearer in the Cloud Google The time is NOW for businesses and organizations of all sizes to implement ... Download Now
- Leveraging SMB ERP for an Economic Recovery ZDNet Times are tough but better days are sure to follow. In the wake of an ... Download Now
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

