std.math performance (SSE vs. real)

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 30 13:22:12 PDT 2014


On Monday, 30 June 2014 at 19:15:44 UTC, Walter Bright wrote:
> On 6/30/2014 11:10 AM, Sean Kelly wrote:
>> 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.
>
> But if you round only for display purposes (and for sending 
> statements to a customer), the customer can easily wind up with 
> accounts that don't balance to the penny.

And in those cases, rounding occurs at the proper points to
ensure that things match whatever on-paper accounting you might
have done.  "Reporting" in this instance may actually mean
writing data to a ledger somewhere.  My point was that
effectively all of the math that's done in these systems is
floating-point.  The fixed-point conversions occur at
serialization points.


More information about the Digitalmars-d mailing list