Modify

Ticket #12798 (closed Bugs: fixed)

Opened 3 months ago

Last modified 3 months ago

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

Change History

comment:1 Changed 3 months ago by johnmaddock

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

comment:2 Changed 3 months ago by michel

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

Regards, Michel

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
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.