Le 03/08/2016 23:58, Hendrik Boom a écrit :
> On Wed, Aug 03, 2016 at 11:51:32PM +0200, Didier Kryn wrote:
>> COBOL has fixed point base 10 operations, which is mandatory for
>> financial computation. C hasn't. I've heared that, in the US at least,
>> floating point operations are illegal in the finance area. The only other
>> language I know which also features this kind of operations is guess
>> which... Ada.
>>
>> I remember, though, I have noticed that the GCC C compiler (or maybe
>> C++) can be built with fixed point operations, but I'm afraid it implies
>> some extension of the language.
> Floating-point just isn't accurate enough. Multiple-precision scaled
> fixed-point would work, even if it's binary.
>
> Early versions of gnucash used floating-point and I reported it as a
> bug. They now use decimal numbers in XML for currency amounts. I
> don't know what they use internally, nor wat they'll use when they
> switch gnucash to a real database instead of an XML file.
>
Actually binary fixed point can trivially be implemented as
integers; therefore any language could feature them. I guess there is a
way to use that to emulate base 10, because I don't know which
architecture have base 10 numbers or base 10 operations today. I
remember some old IBM machines had these types, or these instructions.
Didier