On 15.05.2012 20:49 (UTC+1), Murray Stokely wrote:
On Tue, May 15, 2012 at 10:05 AM, Rainer Hurling<rhur...@gwdg.de>  wrote:
About April 25th, there had been some changes within R-devel's
src/nmath/pnbeta.c (and probably some other relevant places) and now
building R-devel on FreeBSD 10.0-CURRENT (amd64) with gcc-4.6.4 and
math/R-devel (selfmade forked port from math/R) fails like this:

It seems, that at least one new C99 function (log1pl) is introduced in
R-devel, see

src/nmath/pnbeta.c:l95
return (double) (log_p ? log1pl(-ans) : (1 - ans));

AFAIK, Bruce Evans is not happy with the numerical accuracy of other
open-source implementations of log1pl and so has blocked their
inclusion in FreeBSD pending work on a better implementation.

Can you put a conditional FreeBSD check here and use log1p instead of
log1pl instead as a workaround?

I can admire the insistence on correctness from the FreeBSD libm
maintainers for their technical purity, but it can be a bit of a pain
for things like this.

          - Murray

I read about this discussion and in principle I concur with your opinion. As a scientist I tend to expect greatest possible correctness from a statistical routine, especially when it uses long double format.

As a quick and dirty workaround I applied the following patch:


--- src/nmath/pnbeta.c.orig     2012-04-25 17:55:14.000000000 +0200
+++ src/nmath/pnbeta.c  2012-05-15 20:58:26.000000000 +0200
@@ -92,7 +92,11 @@
     else {
        if(ans > 1 - 1e-10) ML_ERROR(ME_PRECISION, "pnbeta");
        if (ans > 1.0) ans = 1.0;  /* Precaution */
+#if !defined(__FreeBSD__)
        return (double) (log_p ? log1pl(-ans) : (1 - ans));
+#else
+        return (double) (log_p ? log1p(-ans) : (1 - ans));
+#endif /* FreeBSD */
     }
 }


It builds and installs fine now and I hope there are no side effects ...

Thank you for the quick answer and your advice,
Rainer

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to