From terra at gnome.org  Fri Oct 22 20:47:44 2004
From: terra at gnome.org (terra@gnome.org)
Date: Fri Oct 22 20:47:46 2004
Subject: [Rd] pgamma discontinuity (PR#7307)
Message-ID: <20041022184744.457E61094C@slim.kubism.ku.dk>

Full_Name: Morten Welinder
Version: 2
OS: Solaris/space/gcc2.95.2
Submission from: (NULL) (65.213.85.217)


I changed src/nmath/standalone/test.c to read:

---------------------------------------------------------------------------------
#define MATHLIB_STANDALONE 1
#include <Rmath.h>
#include <stdio.h>
int
main()
{
  double x;
  for (x = 99990; x <= 100009; x++)
    printf ("%.14g --> %.14g\n", x, pgamma (1000000.0,  x, 1.0, 0, 1));
  return 0;
}
---------------------------------------------------------------------------------

and have no further local changes.

I get...
src/nmath/standalone> LD_LIBRARY_PATH=. ./test 
99990 --> -669773.38974057
99991 --> -669771.08705436
99992 --> -669768.78437815
99993 --> -669766.48171194
99994 --> -669764.17905574
99995 --> -669761.87640953
99996 --> -669759.57377332
99997 --> -669757.27114712
99998 --> -669754.96853091
99999 --> -669752.66592471
100000 --> -669750.36332851
100001 --> -599731.36192347       <--- Look at me jump!
100002 --> -599729.89768519
100003 --> -599728.43344358
100004 --> -599726.96919865
100005 --> -599725.50495039
100006 --> -599724.0406988
100007 --> -599722.57644388
100008 --> -599721.11218564
100009 --> -599719.64792408

i.e., the result changes 70000 orders of magnitude right here.  Ugh.
This is affecting some erlang calculations of mine pretty badly.

Judging from comments in pgamma someone else might have gotten hit by this
around R1.8.1.


[Rd] pgamma discontinuity (PR#7307)
terra@gnome.org