std.math performance (SSE vs. real)

Iain Buclaw via Digitalmars-d digitalmars-d at puremagic.com
Sun Jun 29 08:50:52 PDT 2014


On 29 June 2014 15:59, Andrei Alexandrescu via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 6/28/14, 9:36 PM, H. S. Teoh via Digitalmars-d wrote:
>>
>> On Sat, Jun 28, 2014 at 05:16:53PM -0700, Walter Bright via Digitalmars-d
>> wrote:
>>>
>>> On 6/28/2014 3:57 AM, Russel Winder via Digitalmars-d wrote:
>>
>> [...]
>>
>>>> Or indeed when calculating anything to do with money.
>>>
>>>
>>> You're better off using 64 bit longs counting cents to represent money
>>> than using floating point. But yeah, counting money has its own
>>> special problems.
>>
>>
>> For counting money, I heard that the recommendation is to use
>> fixed-point arithmetic (i.e. integer values in cents).
>
>
> A friend who works at a hedge fund (after making the rounds to the NYC large
> financial companies) told me that's a myth. Any nontrivial calculation
> involving money (interest, fixed income, derivatives, ...) needs floating
> point. He never needed more than double.
>
> Andrei
>

I would have thought money would use fixed point decimal floats.

Iain


More information about the Digitalmars-d mailing list