Modify

Opened 5 months ago

Closed 5 months ago

Last modified 5 months ago

#12798 closed Bugs (fixed)

Strange division evaluation for dynamically allocated `cpp_bin_float`

Reported by: michel Owned by: johnmaddock
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 5 months ago by johnmaddock

  • Milestone changed from To Be Determined to Boost 1.64.0
  • Resolution set to fixed
  • Status changed from new to closed

comment:2 Changed 5 months ago by michel

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

Regards, Michel

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain johnmaddock.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.