Modify

Ticket #6517 (closed Bugs: fixed)

Opened 2 years ago

Last modified 21 months ago

boost::math::isfinite returns false for unsigned int 0

Reported by: Bob Carpenter <carp@…> Owned by: johnmaddock
Milestone: Boost 1.52.0 Component: math
Version: Boost 1.48.0 Severity: Problem
Keywords: math isfinite Cc:

Description

from: boost/math/distributions/detail/common_error_handling.hpp

(boost::math::isfinite)(0U) returns 0

(boost::math::isfinite)(1U) returns 1

To recreate the problem, the following program:


#include <iostream> #include <boost/math/distributions/detail/common_error_handling.hpp> int main(int argc, char* argv[]) {

std::cout << "isfinite(0U)=" << (boost::math::isfinite)(0U) << std::endl; std::cout << "isfinite(1U)=" << (boost::math::isfinite)(0U) << std::endl;

}


prints:


isfinite(0U)=0 isfinite(1U)=0


This can't happen with the std::isinf() tests because they only take floating point args, so the unsigned int would get cast.

Attachments

Change History

comment:1 Changed 22 months ago by johnmaddock

  • Status changed from new to assigned

comment:2 Changed 21 months ago by johnmaddock

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [79438]) Allow fpclassify and friends to be used with integer types via the usual promotion mechanism. Fixes #6517.

comment:3 Changed 21 months ago by johnmaddock

  • Milestone changed from To Be Determined to Boost 1.52.0
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.