Working with the Single Data Type, avoid wrong calculations [Expert Hunt 007]
Posted on 2004-11-11
Fellow experts ;)
Here is a question which I din't find answered in this database. As a matter of fact, I had been working with Access for years before I encountered this bug (it cost me several days to figure it out / fix it)...
In a "homegrown" financial database I was redesigning, rates were applied to investments to calculate management fees. Rates were stored as Single (e.g. 0.325%) and invested amounts as Currency (NAV) times Double (Shares).
Fees = Rate * NAV * Shares
With Fees = 0.325%, NAV = 10,000 Yen, Shares = 10,000,000, you expect:
? 0.00325 * 10000 * 10000000
But in the application, I had 7 Yen more, or 325,000,007... and you can't do that with Japanese clients :)
The present "expert hunt" is to find out how 007 got into this. Happy Hunting :)
Award: Points will be awarded to the following validation rule:
Allow (single) rates from 0% to 1% by quarter points increase (0.025%) only.
It is closely related, believe me, and disqualifies VB solutions :)