Boost logo

Boost :

Subject: Re: [boost] Boost.Random subtract_with_carry doesn't like m == numeric_limits<result_type>::digits
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2016-05-10 15:59:23


AMDG

On 05/10/2016 01:43 PM, Billy O'Neal (VC LIBS) wrote:
>
> MSVC++ said: 0xFCF0A4776BA0A6A8
> Libstdc++ says: 0x01316AEA3646F686
> Libc++ says: 0x01316AEA3646F686
> Boost 1.60.0/libc++ + Clang says: 0x69E18848FE1BD36D
> Boost 1.60.0/libstdc++ + g++ says: 0x1DD6C263C41EEED0
>
> MSVC++'s bug was that we did the underflow check incorrectly resulting in the carry bit always being set if m == numeric_limits<result_type>::digits. I fixed that and MSVC++ will agree with libstdc++ and libc++ in the next update; but boost's behavior here is still strange.
>

The first problem is this:

    BOOST_STATIC_CONSTANT(result_type, modulus = (result_type(1) << w));

which is almost certainly the cause of the
different results for clang vs. g++.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk