OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / original / man3 / catanh.3
index e396021..414eae8 100644 (file)
@@ -1,7 +1,11 @@
 .\" Copyright 2002 Walter Harms (walter.harms@informatik.uni-oldenburg.de)
+.\" and Copyright (C) 2011 Michael Kerrisk <mtk.manpages@gamil.com>
+.\"
+.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
 .\" Distributed under GPL
+.\" %%%LICENSE_END
 .\"
-.TH CATANH 3 2008-08-11 "" "Linux Programmer's Manual"
+.TH CATANH 3 2011-09-15 "" "Linux Programmer's Manual"
 .SH NAME
 catanh, catanhf, catanhl \- complex arc tangents hyperbolic
 .SH SYNOPSIS
@@ -27,14 +31,54 @@ is chosen in the interval [\-pi/2,pi/2].
 One has:
 .nf
 
-    catanh(z) = 0.5 * clog((1 + z) / (1 \- z))
+    catanh(z) = 0.5 * (clog(1 + z) \- clog(1 \- z))
 .fi
 .SH VERSIONS
 These functions first appeared in glibc in version 2.1.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 C99.
-.SH "SEE ALSO"
+.SH EXAMPLE
+.nf
+/* Link with "\-lm" */
+
+#include <complex.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+    double complex z, c, f;
+
+    if (argc != 3) {
+        fprintf(stderr, "Usage: %s <real> <imag>\\n", argv[0]);
+        exit(EXIT_FAILURE);
+    }
+
+    z = atof(argv[1]) + atof(argv[2]) * I;
+
+    c = catanh(z);
+    printf("catanh() = %6.3f %6.3f*i\\n", creal(c), cimag(c));
+
+    f = 0.5 * (clog(1 + z) \- clog(1 \- z));
+    printf("formula  = %6.3f %6.3f*i\\n", creal(f2), cimag(f2));
+
+    exit(EXIT_SUCCESS);
+}
+.fi
+.SH SEE ALSO
 .BR atanh (3),
 .BR cabs (3),
 .BR cimag (3),
+.BR ctanh (3),
 .BR complex (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.