I was writing a small personal accounting software for tracking all my money transactions. I decided to do it in vb.net
(my fav nd the easy one) . I used SQL compact edition to strore the data in local db file. Everything went fine and worked well, but when i testing the application against worst case scenarios i found i a bug. Its the overflow of integer (int64) when dealing with large money, also arithmetic of large money resulted in some strange results due to rounding problem in doubles, the available solution were using decimal type or SQL money type, but both were 64bit overflow problem persists, so decided to implement my own money class , here the integral part is stored in array of bytes representing each digit and a decimal type to represent the floating part, the main issue with this implementation is one byte is required to represent a digit. The class defines operators +,-,* all implemented pure paper pen work method, Since my app is very small and deals with small amounts i decided not to worry about the memory , If someone want to compact the memory more one easy way will be packing the digits like binary packed BCD . the class is attached below
Download
