std.math performance (SSE vs. real)
Sean Kelly via Digitalmars-d
digitalmars-d at puremagic.com
Mon Jun 30 11:10:18 PDT 2014
On Monday, 30 June 2014 at 17:01:07 UTC, Walter Bright wrote:
>
> 1. 64 bit longs have more precision than 64 bit doubles.
>
> 2. My business accounts have no notion of fractional cents, so
> there's no reason to confuse the bookkeeping with them.
>
> I understand that for purposes of calculating interest, you'd
> definitely want the intermediate answers to be in floating
> point. But when posting to an account, you want cents.
If your liquid assets are represented in dollars, yes. But this
is really just a display issue. The amounts could easily be
stored in a floating point representation and rounded when
reporting is done. This is how all financial systems I've ever
worked on have operated (hedge fund accounting systems, trading
systems, and enterprise-level accounting systems used by
companies like Goldman Sachs), though every once in a while you
might encounter one that uses the SQL "money" type for certain
types of accounting.
> And these days, dealing with trillions of dollars, one is
> getting awfully close to the max precision of doubles :-)
To be fair, most accounts don't contain trillions of dollars, or
report on aggregate sums of that magnitude. That's still well
within the realm of special purpose software. And for that I'd
likely be using quads and just live with the performance hit.
More information about the Digitalmars-d
mailing list