andersonpd / eris

A new library for the D programming language
7 stars 0 forks source link

status on std.decimal for Phobos #6

Closed wilzbach closed 4 years ago

wilzbach commented 8 years ago

I would be interest in the status of this project. I saw that those were your big todos.

Continue implementation and testing of the decimal32, decimal64 and decimal128 types.

How far are you with this?

Replace my "extended integer" implementation with std.bigint. I haven't done this before because were a few things that std.bigint doesn't do (or didn't do -- I haven't checked in a while).

What is missing from std.bigint?

andersonpd commented 8 years ago

On 30-Mar-16 12:22 AM, Seb wrote:

I would be interest in the status of this project. I saw that those were your big todos.

Continue implementation and testing of the decimal32, decimal64 and
decimal128 types.

How far are you with this?

Replace my "extended integer" implementation with std.bigint. I
haven't
done this before because were a few things that std.bigint doesn't do
(or didn't do -- I haven't checked in a while).

What is missing from std.bigint?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/andersonpd/eris/issues/6

I have been working on other number sets for the last few months so haven't advanced much on decimals, but I'll be back working on them in April.

Overall, the decimal number set is in good shape except for some math routines. All arithmetic and conversion and classification routines work well and have been thoroughly tested.

The arbitrary-precision decimal module(s) are complete. Most of the math routines (log, exp, trig, etc.) are implemented but are not all in final form. There are some numerical issues in some -- they will not be correct in some instances (usually at large range values that must be correctly reduced).

32- and 64- and 128- bit decimals are working in that there are decimal contexts defined for them and the conversion to/from arbitrary precision decimals for arithmetic are implemented. There are some efficiencies that are available (e.g., using 64-bit long integers for coefficients) that are not fully implemented.

The ongoing problem with std.bigint is that CTFE is not available for the 32-bit Windows version. Because of this eris.decimal will not compile with std.bigint. The fundamental issue is that std.bigint uses assembly language routines for speed-up in the 32-bit Windows versions and asm instructions cannot be evaluated at compile time.

I have, as noted, created a separate big integer type which I am sure is not as fast as std.bigint, but it is correctly implemented. I just hate to see two different bigint implementations in phobos, so I have not pushed to move my eris.decimal to std.decimal until std.bigint is modified.

There was some talk (months ago) about minimal modification to std.bigint, by adding a compiler switch or something to bypass the asm statements if selected. I haven't heard any more. I don't think Don Clugston is intending to make the change and I haven't heard of anyone else stepping up. I don't think I'm the one to do it.

I'll look at the code and give you more specific answers as to what's working, what needs work, and what's not ready for release.

Thanks for your interest. If you have any specific applications in mind, let me know and we can work toward them first.

Paul

andre2007 commented 8 years ago

I am not sure, but I think, there is a compiler switch (version) statement in std.internal.math.biguintcore.

version(D_InlineAsm_X86) { import std.internal.math.biguintx86;} else{ import std.internal.math.biguintnoasm;}

Is this somethink, which you can reuse for std.decimal?

https://github.com/dlang/phobos/blob/master/std/internal/math/biguintcore.d#L36

Kind regards André

wilzbach commented 8 years ago

Thanks for your interest. If you have any specific applications in mind, let me know and we can work toward them first.

Yes I want to push the scientific capabilities of D ;-) Btw if you are interested, we are currently trying to bundle our forces behind the DlangScience project and it's flagship mir.

so I have not pushed to move my eris.decimal to std.decimal until std.bigint is modified.

That's a shame :/

I am not sure, but I think, there is a compiler switch (version) statement in std.internal.math.biguintcore.

Did this help you?

zaydek-old commented 7 years ago

I'd also like to follow-up and ask – what is the current status of std.decimal? Thank you.

wilzbach commented 4 years ago

what is the current status of std.decimal?

std.decimal will never happen as Phobos is feature-frozen.

However, you can either use this dub module or the decimal dub package.