Ben is right, you simply can't use double for any serious financial/scientific calculation. And indeed I hope someday an arbitrary math precision library be part of the standard C++. Look for a standard for the place where this is going to be used. If there isn't one. Use an arbitrary math precision library anyway. Take a look at mapm: http://www.cuj.com/documents/s=8020/cuj0111ring/ http://www.tc.umn.edu/~ringx004/mapm-main.html There are other comercial alternatives, a quick google search produced this: http://www.boic.com/b1mnum.pdf http://www.boic.com/numintro.htm Hope this helps, Mauricio Gomes Pensar Digital phone: 55-11-4121-6287 mobile: 55-11-8319-9610 http://pensardigital.com On Apr 15, 2005, at 2:37 PM, Ben Hutchings wrote:
Sliwa, Przemyslaw (London) wrote:
Thanks, Ben, what should I use for representing the money amounts? A boolean :)) ?
If you're dealing with other people's money then there are regulations that specify the required intermediate precision and rounding rules, which may vary from place to place. I believe you'll need to use fixed-point decimal fractions, perhaps implemented as integer counts of hundredths or ten-thousandths of a currency unit. I've not done this myself so I don't know the details, but I'm fairly sure that getting this wrong can put you on the wrong side of the law.
Ben. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users