Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ gamma(3) — AIX/RT 2.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

exp, log, log10, pow, sqrt

matherr

gamma

Purpose

     Computes the logarithm of the gamma function.

Library

     Math Library (libm.a)

Syntax

     #include <math.h>

     extern int signgam;

     double gamma (x)
     double x;

Description

     The  gamma  subroutine  returns  ln(|&Gamma.(x)|),  where
     &Gamma.(x)  is defined  as:   the integral  from zero  to
     infinity of e(-t) t(x-1) dt.

     The sign of &Gamma.(x) is  stored in the external integer
     variable signgam.   The x parameter cannot  be a nonposi-
     tive integer.

     If  the  x  parameter  is a  nonpositive  integer,  gamma
     returns HUGE,  sets errno  to EDOM,  and writes  a DOMAIN
     error message to standard error.

     If the  correct value  overflows, gamma returns  HUGE and
     sets errno to ERANGE.

     You  can change  the error  handling procedures  with the
     matherr subroutine.

Examples

     The following C  program fragment calculates &Gamma.("x")
     and stores the result in "y":

       errno = 0;
       y = gamma(x);
       if (errno == 0)
          y = signgam * exp(y);
       else
          perror("Error in gamma function");

Related Information

     In  this   book:   "exp,  log,  log10,   pow,  sqrt"  and
     "matherr."

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026