"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/complex/alt/cihypa.c" (11 Oct 2000, 992 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "cihypa.c" see the Fossies "Dox" file reference documentation.

    1 /*  cihypa.c    CCMATH mathematics library source code.
    2  *
    3  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
    4  *  This code may be redistributed under the terms of the GNU library
    5  *  public license (LGPL). ( See the lgpl.license file for details.)
    6  * ------------------------------------------------------------------------
    7  */
    8 /*
    9      alternate acosh branches for relativistic kinematics
   10 */
   11 #include "complex.h"
   12 struct complex casinh(Cpx z)
   13 { struct complex u;
   14   u.re=1.; u.im=0.;
   15   u=csqrt(cadd(u,cmul(z,z)));
   16   u.re+=z.re; u.im+=z.im;
   17   return clog(u);
   18 }
   19 struct complex cacosh(Cpx z)
   20 { struct complex u;
   21   u.re=1.; u.im=0.;
   22   u=csqrt(csub(cmul(z,z),u));
   23   z.re+=u.re; z.im+=u.im; z=clog(z);
   24   if(z.im<0.){ z.re= -z.re; z.im= -z.im;}
   25   return z;
   26 }
   27 struct complex catanh(Cpx z)
   28 { struct complex u;
   29 /*
   30   int kf;
   31   if(z.im==0. && z.re>1.) kf=1; else kf=0;
   32 */
   33   u.re=1.; u.im=0.;
   34   u=cdiv(cadd(u,z),csub(u,z));
   35   u=crmu(.5,clog(u));
   36 /*
   37   if(kf) u.im= -u.im;
   38 */
   39   return u;
   40 }