delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/10/17:28:24

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Wed, 10 Oct 2007 23:27:59 +0200
From: Angelo Graziosi <Angelo DOT Graziosi AT roma1 DOT infn DOT it>
To: cygwin AT cygwin DOT com
Subject: A problem wit tgamma function
Message-ID: <Pine.CYG.4.58.0710102322420.3668@homepc>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

For the sake of completeness I want to flag this.

A recent failure of GFortran tests, regarding the usage of GAMMA
functions, results in the following problem with 'tgamma' on Cygwin
(gcc-3.4.4-3):

=============================================================
/*
  gcc --std=c99 test_tgamma.c -lm && ./a.out
*/
#include <math.h>
#include <stdio.h>

#define N_MAX 34
#undef M_PI
#define M_PI 3.14159265358979323846

int main()
{
  float c[N_MAX+1];
  float xs, ts;
  float diff;
  int i;

  c[0] = 1.;
  for (i=1; i<=N_MAX; i++)
    c[i] = (2*i-1)*c[i-1]*0.5;

  for (i=1; i<=N_MAX; i++)
    {
      xs = i + 0.5f;  /* argument to the gamma function */
      ts = c[i] * sqrtf(M_PI);
      diff = fabsf(tgammaf(xs)-ts)/ts;
      if (diff > 1e-6)
        printf("Arg: %g, Exact: %12.8g, tgamma: %12.8g, diff: %12.8g\n",
              xs, ts, tgammaf(xs), diff);
    }
  return 0;
}
=============================================================

$ ./a.exe
Segmentation fault (core dumped)



Cheers,

   Angelo.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019