Forthcoming Decimal Library review (15th Jan)

Just a gentle reminder that the review of the decimal number library by Matt Borland and Chris Kormanyos will start NEXT WEDNESDAY 15th Jan. The library is an implementation of IEEE 754 Decimal Floating Point Numbers. Documentation: https://cppalliance.org/decimal/decimal.html Code: https://github.com/cppalliance/decimal/ Motivation: Current C++ floating point types store the significand (often incorrectly referred to as the mantissa) as binary digits. Famously this leads to representation errors: https://0.30000000000000004.com https://0.30000000000000004.com. Decimal floating point numbers avoid this issue by storing the significand in base-10 (decimal). The other major difference between binary and decimal floating point types is that the latter allows for multiple representations of the same number. For example 1e5 could also be stored as 0.1e6, 0.01e7, so on and so forth. These are referred to as cohorts which binary does not have as there is only one way to represent each number in binary floating point. Use Cases: The use case for Decimal Floating Point numbers is where rounding errors are significantly impactful such as finance. In applications where integer or fixed-point arithmetic are used to combat this issue Decimal Floating Point numbers can provide a significantly greater range of values. For example, while a fixed-point representation that allocates 8 decimal digits and 2 decimal places can represent the numbers 123456.78, 8765.43, 123.00, and so on, a floating-point representation with 8 decimal digits could also represent 1.2345678, 1234567.8, 0.000012345678, 12345678000000000, and so on. I believe Matt has some minor doc updates to push between now and next week, but other than that the library is good to review (but hold your fire until we start next week unless you're away etc). Best, John.
participants (1)
-
John Maddock