Modify

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#12798 closed Bugs (fixed)

Strange division evaluation for dynamically allocated `cpp_bin_float`

Reported by: Michel Morin Owned by: John Maddock
Milestone: Boost 1.64.0 Component: multiprecision
Version: Boost Development Trunk Severity: Problem
Keywords: Cc:

Description

With this code

#include <iostream>
#include <boost/multiprecision/cpp_bin_float.hpp>

using namespace boost::multiprecision;
using Real = number<cpp_bin_float<10000, digit_base_10, std::allocator<void>>>;

int main(int argc, char* argv[])
{
    std::cout << 1 / Real(1.4) << std::endl;
    return 0;
}

assertion fails as

Assertion failed: 
((
    eval_msb(q)
    ==
    cpp_bin_float<Digits, DigitBase, Allocator, Exponent, MinE, MaxE>::bit_count - 1
)), 
function eval_divide, file boost/multiprecision/cpp_bin_float.hpp, line 1086.

or it prints 26699.6 when compiled with NDEBUG. If I change Real(1.4) to Real(1), the program does not terminate.

Tested on g++-5.4.

Attachments (0)

Change History (2)

comment:1 Changed 10 months ago by John Maddock

Milestone: To Be DeterminedBoost 1.64.0
Resolution: fixed
Status: newclosed

comment:2 Changed 10 months ago by Michel Morin

Confirmed that the testcase works fine. Thanks for the quick fix!

Regards, Michel

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Maddock.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.