[LLVMbugs] [Bug 20843] New: binomial_distribution<unsigned> is broken.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 4 03:51:52 PDT 2014


            Bug ID: 20843
           Summary: binomial_distribution<unsigned> is broken.
           Product: libc++
           Version: 3.4
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ineaugh at gmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

The binomial_distribution class from <random> must allow any of the following
types as result_type, required by the c++ standard: short, int, long, long
long, unsigned short, unsigned int, unsigned long, or unsigned long long.
However, when binomial_distribution<unsigned> is used, it will often return
values outside of its supposed range, which are in fact -2 casted to the
unsigned type.

Note that using unsigned types with binomial_distribution makes sense, because
its result must never be negative.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140904/864ca950/attachment.html>

More information about the llvm-bugs mailing list