Boost logo

Boost :

Subject: Re: [boost] [decimal] Proposed portable implementation ofstd::decimal
From: Christopher Kormanyos (e_float_at_[hidden])
Date: 2012-05-18 16:54:00

> A first draft of this library is available at
> Runs on MSVC10 and gcc 4.6.3.

OK, Josh. Sorry I have not weighed in on this interesting
proposal until now. I have included some very detailed
comments below.

> Wraps the Intel implementation only,
In my opinion, this is a good start. But to really improve the
portability and usefulness of your proposal, you might want
to consider writing your own portable decimal back end.

> Until we resolve the licencing issue, top-level README contains
> detailed instructions about where to get 3rd party code and what to do
> with it.
As far as I know, you simply won't get the third party code into boost.
Perhaps I'm wrong here. But the best you can do is create a front
end C++ implementation in as portable a way as possible and
provide a mechanism for linking with prebuilt versions of the
3rd-party library. This is, for example, what we have done with
GNU GMP, MPFR and MPIR in association with the proposed
Boost.Multiprecision library.

> I'm keen on feedback on a particular point (although all feedback is
> of course welcome!):

> So... what do people think?
> Regards, Josh.

Josh, I believe you have made a good start. But as mentioned above,
a boost decimal implementation really would, in my opinion, mandate
a fully portable boost-owned decimal back end.

It looks like we are entering, well, a very *numeric* time at boost.
Just take a look at the review schedule. We've got quaternions,
multiprecision, complex numbers and there has been recent
interest in creating a potential boost fixed-point implementation.

It only makes sense to consider a decimal implementation.
But we would need to figure out how this would best fit into
the existing (and potentially future) numerical context of boost.

I know, you can never please all the people all the time.
But from a guy who has written numerous custom number
back ends, here's what I would suggest:

1) Consider writing your own fully portable, boost-owned decimal.
Provide the Intel compatibility as an optimized back-end for
selected architecture. You would need a bit more software
architecture to support multiple back ends.
2) I'm probably jumping the gun here, but you may want to take a look
at the back-end requirements for a number type in the proposed
Boost.Multiprecision. You might eventually want to target compatibility
with this potential boost library.
3) You have some amounts of code in cpp source files. In my
opinion, a decimal implementation should be header-only.
The one exception is the use of library code mentioned earlier.
One of the powers of boost is its portability. And this is strongly
facilitated with its emphasis on header-only libraries.
4) Is there any connection between decimal and fixed-point?
If so, do you want to contact Vicente Escriba who is concerned
with fixed-point?
5) Do you need any elementary transcendental functions
such as sin, cos, tan, exp, log, etc. Do you want to support
any of these? Do your potential users need them? If so,
I could potentially point you in the right direction for getting
started on some potentially sensible algorithms in the digit
ranges you are targeting.

Again, to iterate lika a broken record...

Why don't you make a first attempt at writing the code
for the *guts* of the decimal types. I would be in a position
to assist you with this, if you would like. However, I will be
available at the earliest in fall for any significant contribution
on a project with this level of complexity.

Good luck on this interesting project.
Best regards, Chris.

Boost list run by bdawes at, gregod at, cpdaniel at, john at