
On 18.01.25 17:44, Matt Borland via Boost wrote:
Using the example from the webpage DECIMAL(5,2) gives us the range -999.99 to 999.99, but decimal will store it as -9.9999e+02 to 9.9999e+02. As long as you limit yourself to chars_format::fixed on any potential output to the user you should be fine. One of the original users wanted to add bitcoin to their trading platform but the smallest divisible unit of a bitcoin, a satoshi = 1/100 million of a bitcoin, exceeded the precision of their in-house fixed point system so they switched to using decimal64.
Using floating point when you mean fixed point is a really bad practice. You are going to end up with fractional satoshis, and you won't even see them because you are using chars_format::fixed. All you'll see is that 0.000000001 + 0.000000001 is sometimes mysteriously 0.000000003 instead of 0.000000002. You might as well use binary instead of decimal floating point at that point. -- Rainer Deyke - rainerd@eldwood.com