octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #65230] Poor accuracy of betaln for high ratio


From: Rik
Subject: [Octave-bug-tracker] [bug #65230] Poor accuracy of betaln for high ratios of a/b
Date: Wed, 31 Jan 2024 18:22:07 -0500 (EST)

Update of bug#65230 (group octave):

                Severity:              3 - Normal => 2 - Minor              
                  Status:                    None => Confirmed              
                 Summary: Poor accuracy of betaln for most inputs due to
catastrophic cancellation => Poor accuracy of betaln for high ratios of a/b

    _______________________________________________________

Follow-up Comment #1:

I can confirm that at high ratios of a/b the betaln() function always returns
zero.  The cause is straightforward.  In betaln.m the output is calculated as


  lnb = gammaln (a) + gammaln (b) - gammaln (a + b);


When a and b are different enough in size the finite precision of IEEE
floating point causes a problem and the sum "a + b" is just equal to "a".

However, it's not clear to me that this is a frequent occurrence.  For
example, do constraints from real-world problems limit the sizes of a, b, and
their ratio?  I would also observe that Matlab exhibits exactly the same
behavior as Octave.  Maybe they are unaware of this corner case, or maybe they
consider it unlikely.  I also note that Mathematica doesn't even offer a log
beta function.  The help discussions simply point to writing such a function
in terms of gammaln in exactly the way Octave has done.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]