Opened 10 years ago

Closed 10 years ago

#6938 closed Bugs (fixed)

weibull_distribution accepts shape == 0, but shape should be >0

Reported by: Florian Schoppmann <Florian.Schoppmann@…> Owned by: John Maddock
Milestone: Boost 1.51.0 Component: math
Version: Boost 1.49.0 Severity: Problem
Keywords: Cc: pbristow@…

Description

In function check_weibull_shape() in file math/distributions/weibull.hpp a domain error is only raised if shape < 0. The error condition should probably be shape <= 0. With shape == 0, the Weibull distribution is not well-defined. Also, shape == 0 contradicts the error message in the same function.

E.g., the following example raises an overflow error, but not a domain error (as would be more appropriate IMHO):

#include <boost/math/distributions/weibull.hpp>
using namespace boost::math;
int main() {
    std::cout << mean(weibull(0)) << std::endl;
}

Change History (3)

comment:1 by John Maddock, 10 years ago

Cc: pbristow@… added
Milestone: To Be DeterminedBoost 1.51.0
Status: newassigned

comment:2 by John Maddock, 10 years ago

Confirmed, will fix.

comment:3 by John Maddock, 10 years ago

Resolution: fixed
Status: assignedclosed

(In [78723]) Tighten Weibull distro tests. Fix corner cases in Weibull distro. Fixes #6939. Fixes #6938.

Note: See TracTickets for help on using tickets.