On 2026-10-16, Leroy H <l…@somewhere.net> wrote:
> On Fri, 16 Oct 2026 17:10:18 GMT, Jan Panteltje wrote:
>
>> I have written financial software in C.
>> What is the problem?
>
> That depends on the scale.
>
> For most situations, the currency amounts are enough that the
> C double type, with 16 decimal digits of precision, can handle
> the simple processing without error.
Now that 64-bit ints are available, you could use them
in many situations.
> (C also has a 128-bit long double type but ordinary processors
> have no hardware for this type. On GNU/Linux the long double
> is usually defined as 80-bits.)
>
> But for large currency amounts and more complex processing,
> 16 decimal digits may not be enough. That's why decimal floating
> point is recommended or even required by law.
>
> What is needed is HARDWARE decimal FP. IBM has always had decimal
> FP hardware in its mainframes
FSVO "always". But the original 360 had packed decimal, which
can work with up to 31 decimal digits. I wrote a lot of business
software in those days; I can count the number of times I've used
floating point on the fingers of one hand. For basic accounting,
integer pennies are enough. Add a few guard digits if you must.
To quote the old commercial, it "takes the worry out of being close".
--
/~\ Charlie Gibbs | In this world there are
\ / <cgib…@kltpzyxm.invalid> | two kinds of people:
X I'm really at ac.dekanfrus | 1. Those who can extrapolate
/ \ if you read it the right way. | from incomplete data.