Modify

Ticket #12112 (closed Bugs: fixed)

Opened 12 months ago

Last modified 12 months ago

cpp_dec_float: assigning double(-infinity) drops the negative

Reported by: Jason Rhinelander <jason@…> Owned by: johnmaddock
Milestone: To Be Determined Component: multiprecision
Version: Boost 1.60.0 Severity: Problem
Keywords: Cc:

Description

Initializing (or assigning) negative infinity to a cpp_dec_float assigns positive infinity instead of negative infinity.

The problem seems to be that cpp_dec_float.hpp, in operator=(long double a), does:

   if((boost::math::isinf)(a))
      return *this = inf();

but I think that should instead be (I have not tested this):

    if((boost::math::isinf)(a)) {
       *this = inf();
       if (a < 0) negate();
       return *this;
    }

Attachments

Change History

comment:1 Changed 12 months ago by johnmaddock

  • Status changed from new to closed
  • Resolution set to fixed
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.