[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2019-05-22 Thread hp at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

Hans-Peter Nilsson  changed:

   What|Removed |Added

 CC||hp at gcc dot gnu.org

--- Comment #6 from Hans-Peter Nilsson  ---
A note for the record:

(In reply to pa...@gcc.gnu.org from comment #5)
> Author: paolo
> Date: Sun Dec 24 22:08:52 2017
> New Revision: 255993
> 
> URL: https://gcc.gnu.org/viewcvs?rev=255993=gcc=rev
> Log:
> 2017-12-24  Michele Pezzutti 
> 
>   PR libstdc++/83237
>   * include/bits/random.tcc (poisson_distribution<>::operator()):
>   Fix __x = 1 case - see updated Errata of Devroye's treatise.
>   * testsuite/26_numerics/random/poisson_distribution/operators/
>   values.cc: Add test.

Please don't "add test" to an existing file like that, instead put it in a new
file.

(This method of adding a test can cause side-effects such as a timeout. 
Example: cris-elf which runs in a simulator, now needs >10 minutes on a
"i7-4770K CPU @ 3.50GHz".  I intend to split up the test, as has been done in
the past.)

Also a question: is there a reasonable (much) lower number combination than the 
"testDiscreteDist<100, 200>" in the test?  Perhaps that part of the test
can reasonably be disabled for simulator targets?

(Also, it seems this PR should be closed as the original issue has been fixed.)

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-24 Thread paolo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

--- Comment #5 from paolo at gcc dot gnu.org  ---
Author: paolo
Date: Sun Dec 24 22:08:52 2017
New Revision: 255993

URL: https://gcc.gnu.org/viewcvs?rev=255993=gcc=rev
Log:
2017-12-24  Michele Pezzutti 

PR libstdc++/83237
* include/bits/random.tcc (poisson_distribution<>::operator()):
Fix __x = 1 case - see updated Errata of Devroye's treatise.
* testsuite/26_numerics/random/poisson_distribution/operators/
values.cc: Add test.
* testsuite/26_numerics/random/pr60037-neg.cc: Adjust dg-error
line number.

Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/random.tcc
   
trunk/libstdc++-v3/testsuite/26_numerics/random/poisson_distribution/operators/values.cc
trunk/libstdc++-v3/testsuite/26_numerics/random/pr60037-neg.cc

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-18 Thread 3dw4rd at verizon dot net
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

Ed Smith-Rowland <3dw4rd at verizon dot net> changed:

   What|Removed |Added

 CC||3dw4rd at verizon dot net

--- Comment #4 from Ed Smith-Rowland <3dw4rd at verizon dot net> ---
Yes, this is a problem.  In addition to the fix I want to get a citation to
that excellent book mentioned (or any other) with the page of the generator in
a comment.  If someone can beat me to that it would be great.

I would like to get refs for all of our math work.

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-14 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

Jonathan Wakely  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #3 from Jonathan Wakely  ---
Patch was posted for review:
https://gcc.gnu.org/ml/gcc-patches/2017-12/msg00573.html

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-10 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-12-10
 Ever confirmed|0   |1

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-10 Thread mpezz at tiscali dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

--- Comment #2 from Michele Pezzutti  ---
Created attachment 42821
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42821=edit
patch for latest version

[Bug libstdc++/83237] Values returned by std::poisson_distribution are not distributed correctly

2017-12-10 Thread mpezz at tiscali dot it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83237

Michele Pezzutti  changed:

   What|Removed |Added

 CC||mpezz at tiscali dot it

--- Comment #1 from Michele Pezzutti  ---
I think the value of the comparison function should be set to 1/78 for __x = 1:
* include/bits/random.tcc (poisson_distribution<_IntType>::operator()):

With gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

1E8 samples

N libstdc++patch expected
155   3154430  3155726   3154821.01
156   3178062  3179345   3178482.17
157   3179989  3181280   3181923.84
158   3204922(*)   3165234   3165208.67
159   3127941  3129209   3128778.91

(*) problematic value