URL:
  <https://savannah.gnu.org/bugs/?66800>

                 Summary: Feature: gsl_ran_negative_binomial_pdf with p = 1
                   Group: GNU Scientific Library
               Submitter: fermelelundi
               Submitted: Sat 15 Feb 2025 10:38:17 AM UTC
                Category: Accuracy problem
                Severity: 3 - Normal
        Operating System:
                  Status: None
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 2.8


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Sat 15 Feb 2025 10:38:17 AM UTC By: Fermé le Lundi <fermelelundi>
As per Eric Redekopp (University of Saskatchewan), cf
https://lists.gnu.org/archive/html/bug-gsl/2023-09/msg00001.html

gsl_ran_negative_binomial_pdf gives -NaN if p == 1.0, despite p=1 being a
valid negative binomial distribution. I believe this is because of the call to
log1p(-p) which evaluates to log(0) and gives NaN. There appear to be guards
against this in the positive version (gsl_ran_binomial_pdf) and it works as
expected, however these edge cases aren't covered in the negative version. I
think that the negative version should have similar guards to return
appropriate values for edge cases like p==1.

The attached patch fixes this issue and aligns with the analogous fix in
binomial.c.








    _______________________________________________________
File Attachments:


-------------------------------------------------------
Name: nbinomial.diff  Size: 606B
<https://file.savannah.gnu.org/file/nbinomial.diff?file_id=56899>

    AGPL NOTICE

These attachments are served by Savane. You can download the corresponding
source code of Savane at
https://savannah.gnu.org/source/savane-9aa36b8aaaab70f75d4f4abb1d9f8d6bd3eed2b1.tar.gz

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?66800>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/

Attachment: signature.asc
Description: PGP signature

Reply via email to