Pecunia
Safe C++ Currency Library
Description
Pecunia is designed to be an easy to use C++ currency library.
Stable Version 0.8.1
There are packages of the current stable version below, or checkout the stable release branch using Mercurial .
Features
- All mathematical operations are guaranteed to not overflow nor underflow.
- The represented amount has extra guard precision built into all operations.
- Has all the currency codes in the ISO-4217 standard .
- Has all the currency currency symbols of common currencies.
- Automatic conversions between currencies. With support for custom currency converters.
- Support for common high-level mathematical operations, e.g. summation, absolute value, etc.
- Built-in common rounding functions with support custom ones as well.
Example
Below is an illustration of adding two items purchased and storing their sum into a single variable.
Money
pop{Currency::USD
, 1, 25};Money
candy{Currency::USD
, 0, 75};Money
sum{pop + candy};// Sum holds 2 USD.
More complex examples and explanations are available on the Wiki .
Known Issues
- Stream insertion operator does not clean up afterwards.
- Stream extraction operator does not clean up afterwards.
- Stream Insertion does not work correctly on Windows and macOS.
Report Issues
If you have an issue, enhancement, or wish that you would like to let us know. Please submit your report and we'll address it.
Downloads & Packages
Operating system specific packages and installers are available below. Select the download which most matches your computer and desired install wishes.
Binary
Select a download below to have a runnable version installed onto your computer. All
binary packages are signed using this
FSF key
.
The signatures can be verified using
GNU Privacy Guard
.
Type | Debian | Fedora | macOS | Mageia | Windows |
---|---|---|---|---|---|
Executable | AMD 64 — Hash Verification — Verification Signature | AMD 64 — Hash Verification — Verification Signature | Not Available | AMD 64 — Hash Verification — Verification Signature | Win 64 Installer — Hash Verification — Verification Signature |
Debug | AMD 64 — Hash Verification — Verification Signature | AMD 64 — Hash Verification — Verification Signature | Not Available | AMD 64 — Hash Verification — Verification Signature | Available within the installer. |
Development | AMD 64 — Hash Verification — Verification Signature | AMD 64 — Hash Verification — Verification Signature | Not Available | AMD 64 — Hash Verification — Verification Signature | Available within the installer. |
Source
Select the download below to have the source code extracted onto your computer.
Development
You can track the development version by using Mercurial on the default branch .
Repository hosting is generously provided by Octobus and Clever cloud .