Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#6517 closed Bugs (fixed)

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

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


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;



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 (0)

Change History (3)

comment:1 Changed 5 years ago by John Maddock

Status: newassigned

comment:2 Changed 5 years ago by John Maddock

Resolution: fixed
Status: assignedclosed

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

comment:3 Changed 5 years ago by John Maddock

Milestone: To Be DeterminedBoost 1.52.0

Modify Ticket

Change Properties
Set your email in Preferences
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.