public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug libstdc++/67011] division by zero in std::exponential_distribution [not found] <bug-67011-4@http.gcc.gnu.org/bugzilla/> @ 2015-07-26 20:32 ` redi at gcc dot gnu.org 2015-07-26 20:50 ` redi at gcc dot gnu.org 2015-07-27 14:25 ` kretz at kde dot org 2 siblings, 0 replies; 3+ messages in thread From: redi at gcc dot gnu.org @ 2015-07-26 20:32 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67011 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- One is for std::exponential_distribution and one is for std::tr1:exponential_distribution. The former is already fixed and the latter is moribund and we don't really care about it any more. ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/67011] division by zero in std::exponential_distribution [not found] <bug-67011-4@http.gcc.gnu.org/bugzilla/> 2015-07-26 20:32 ` [Bug libstdc++/67011] division by zero in std::exponential_distribution redi at gcc dot gnu.org @ 2015-07-26 20:50 ` redi at gcc dot gnu.org 2015-07-27 14:25 ` kretz at kde dot org 2 siblings, 0 replies; 3+ messages in thread From: redi at gcc dot gnu.org @ 2015-07-26 20:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67011 --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- Although if you're still seeing a problem with std::exponential_distribution then I guess it's not the same bug. (Please ignore tr1/random.h unless you're actually using std::tr1::exponential_distribution ... and if you are using that, you should consider not using it :-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug libstdc++/67011] division by zero in std::exponential_distribution [not found] <bug-67011-4@http.gcc.gnu.org/bugzilla/> 2015-07-26 20:32 ` [Bug libstdc++/67011] division by zero in std::exponential_distribution redi at gcc dot gnu.org 2015-07-26 20:50 ` redi at gcc dot gnu.org @ 2015-07-27 14:25 ` kretz at kde dot org 2 siblings, 0 replies; 3+ messages in thread From: kretz at kde dot org @ 2015-07-27 14:25 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67011 Matthias Kretz <kretz at kde dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kretz at kde dot org --- Comment #3 from Matthias Kretz <kretz at kde dot org> --- The problem is that (result_type(1) - __aurng()) must never be zero (because std::log might raise FE_DIVBYZERO for std::log(0)). If __aurng() is a distribution guaranteed to exclude result_type(1) then this works fine. AFAIK std::generate_canoncial<float> sometimes generates a 1 (cf. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63176). Also, I'm wondering whether the 1 - rng wouldn't reduce the randomness. Consider: std::log(numeric_limits<float>::min()) -> -87.3365478515625 std::log(1.f - nextafter(1.f, 0.f)) -> -16.635532379150390625 IIUC, the effect of log(1 - rng) is that the distance between random values from std::exponential_distribution is considerable larger than for log(rng). ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-27 14:25 UTC | newest] Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-67011-4@http.gcc.gnu.org/bugzilla/> 2015-07-26 20:32 ` [Bug libstdc++/67011] division by zero in std::exponential_distribution redi at gcc dot gnu.org 2015-07-26 20:50 ` redi at gcc dot gnu.org 2015-07-27 14:25 ` kretz at kde dot org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).