On Saturday, 31 October 2015 at 16:06:47 UTC, Russel Winder wrote:
On Sat, 2015-10-31 at 15:41 +0000, tcak via Digitalmars-d-learn
wrote:
On Saturday, 31 October 2015 at 14:37:23 UTC, rumbu wrote:
> On Friday, 30 October 2015 at 10:35:03 UTC, Laeeth Isharc
> wrote:
> > I'm writing a talk for codemesh on the use of D in finance.
> >
> > Any other thoughts?
>
> For finance stuff - missing a floating point decimal data
> type. Things like 1.1 + 2.2 = 3.3000000000000003
I always thought that this type of arithmetic operations can
be solved with BigInt, but never tried it. Since the issue is
related to IEEE standard, a simulated (not supported by
hardware directly) data type might be required.
In that std.bigint.BigInt provides the accuracy, yes it does
suffice. But it is slow. As far as I am aware only IBM Big Iron
(aka mainframes, aka z-Series) has hardware decimal floating
point these days. (Even though 1970s and 1980s microprocessors
had the feature.)
It would be nice to have fixed point numbers in Phobos, although
it's not much work to implement, and there is a library solution
already (which is maintained, but sometimes for a while breaks
with newer versions of dmd).