good reasons not to use D?
rumbu via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Oct 31 11:23:42 PDT 2015
On Saturday, 31 October 2015 at 15:42:00 UTC, tcak 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.
Bigint îs enough only for addition or subtraction as long as you
keep a commonly agreed constant scale. Once you need
multiplication, division or rounding, managing a dynamic scale
can be very messy.
IEEE standard is also divided between two standard formats: DPD
preferred by IBM and BID preferred by Intel.
Currently a DPD partial implementation is available on
code.dlang.org; Unfortunately it's not updated since 4 months.
The author proposed this for phobos integration without success.
My opinion is that a decimal data type must be builtin in any
modern language, not implemented as a library.
More information about the Digitalmars-d-learn
mailing list