good reasons not to use D?

rumbu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Nov 4 07:47:50 PST 2015


On Wednesday, 4 November 2015 at 12:25:31 UTC, Laeeth Isharc 
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.
>
> Sorry - I wrote this in a hurry, and I should have said on my 
> experience of using D in finance (not the whole sector, which 
> is absolutely enormous and very diverse), and what lessons and 
> general things might be useful for others considering D.
>
> I can imagine lack of fixed point might be a problem.  
> Shouldn't this be in Phobos?  If BigInt is, then why not fixed 
> point?  There is this library here - had some problems 
> compiling it last time (dmd versions), but it seems at least 
> somewhat thought-through:
>
> https://github.com/jaypha/fixed
>
> train system ought to be sufficient to make that point...

This module is nice (except the fact that's using std.math.lround 
all over the place which is available only on Linux) but, as I 
thought, keeping just a scale is not enough for multiplication or 
division:

Fixed!4 a = "1_000_000_000_000.0000";
Fixed!4 b = "0.5000";
Fixed!4 c = "2.0000";

writeln((a * b).asString) will output -53402322211.2865
writeln((a / c).asString) will output 38831398157.2612

That's because we have a multiplication overflow in both cases.




More information about the Digitalmars-d-learn mailing list