|
Boost : |
Subject: Re: [boost] [review queue] What to do about the library review queue?
From: degski (degski_at_[hidden])
Date: 2017-03-15 19:24:31
On 14 March 2017 at 22:25, Robert Ramey via Boost <boost_at_[hidden]>
wrote:
> A much more interesting question: Why did you not submit a review
> yourself? I think it would have been helpful to me as an author and to you
> in better understanding your own concerns.
Because I think the idea is flawed from the start.
int x = 2 * 2;
is wrong in principle, correct would be:
int64_t x = 2 * 2;
This is what happens in the CPU. C and C++ are wrong to allow multiplying
two ints and assign the result to an int (the cpu does not do that!). Then
of course there is the issue of two's-complement, clouding stuff even
further.
If one wants to be safe, the only real option is to use bignums (GMP,
whatever). This is what implementations of languages like prolog and scheme
do (I'm thinking of SWI-Prolog and Racket f.e.). Shifts (left of right) get
a whole different meaning...
Reals (floats, doubles, quads) are already so broken in many ways, that I
wouldn't even like to comment. Even MPFR doesn't add much here, except
increased (but still relative) precision.
I'm of the opinion that the only real option (if one wants performance) is
to be very aware, learned and carefull regarding the issues, when dealing
with numbers in C or C++. And this is far from simple, signed zeros,
subnormal numbers, infinities, NaN's, roundings...
One of the review questions is: "would you use it?"
Sorry, no!
degski
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk