Boost C++ Libraries: Ticket #6938: weibull_distribution accepts shape == 0, but shape should be >0 https://svn.boost.org/trac10/ticket/6938 <p> In function <code>check_weibull_shape()</code> in file <code>math/distributions/weibull.hpp</code> a domain error is only raised if <code>shape &lt; 0</code>. The error condition should probably be <code>shape &lt;= 0</code>. With <code>shape == 0</code>, the Weibull distribution is not well-defined. Also, <code>shape == 0</code> contradicts the error message in the same function. </p> <p> E.g., the following example raises an overflow error, but not a domain error (as would be more appropriate IMHO): </p> <pre class="wiki">#include &lt;boost/math/distributions/weibull.hpp&gt; using namespace boost::math; int main() { std::cout &lt;&lt; mean(weibull(0)) &lt;&lt; std::endl; } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6938 Trac 1.4.3 John Maddock Sun, 27 May 2012 17:43:53 GMT status, milestone changed; cc set https://svn.boost.org/trac10/ticket/6938#comment:1 https://svn.boost.org/trac10/ticket/6938#comment:1 <ul> <li><strong>cc</strong> <span class="trac-author">pbristow@…</span> added </li> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> <li><strong>milestone</strong> <span class="trac-field-old">To Be Determined</span> → <span class="trac-field-new">Boost 1.51.0</span> </li> </ul> Ticket John Maddock Sun, 27 May 2012 18:08:09 GMT <link>https://svn.boost.org/trac10/ticket/6938#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6938#comment:2</guid> <description> <p> Confirmed, will fix. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 28 May 2012 16:27:02 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/6938#comment:3 https://svn.boost.org/trac10/ticket/6938#comment:3 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> (In <a class="changeset" href="https://svn.boost.org/trac10/changeset/78723" title="Tighten Weibull distro tests. Fix corner cases in Weibull distro. ...">[78723]</a>) Tighten Weibull distro tests. Fix corner cases in Weibull distro. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6939" title="#6939: Bugs: pdf(weibull(shape, scale), 0) == 0 even if shape &lt;= 1 (closed: fixed)">#6939</a>. Fixes <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/6938" title="#6938: Bugs: weibull_distribution accepts shape == 0, but shape should be &gt;0 (closed: fixed)">#6938</a>. </p> Ticket