Fixed Point Decimal Class for C++
I recently needed a fixed point decimal support in C++ for an inventory program I’m writing. Why doesn’t one already exist? I don’t know. There’s one for boost, but since I’m already using Qt, I don’t really see a need to pull in yet another (big) dependency.
It’s public domain, and appears to work (for me, anyway). It’s all standard C++ with no extra dependencies, and should work on all operating systems (although I’ve only tested it on Linux/g++-3.4). Please shoot me a mail (tajmorton@gmail.com) or leave a comment if you find a problem. See this page for it if you’re interested (hello Google bot):
June 24th, 2007 at 10:28 am
I’m not sure if it’s the case for that class specifically in boost, but the vast majority of boost libraries are header only templates. These are statically compiled in (so they aren’t a packaging concern) and you only ‘link’ against the templates you actually instantiate (so it wouldn’t bloat the executable either). So I wouldn’t really be concerned about the dependency.