OSDN Git Service

(split) Convert release and draft pages to UTF-8.
[linuxjm/LDP_man-pages.git] / release / man3 / log.3
1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
2 .\" and Copyright 2008, Linux Foundation, written by Michael Kerrisk
3 .\"     <mtk.manpages@gmail.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .\" Since the Linux kernel and libraries are constantly changing, this
15 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
16 .\" responsibility for errors or omissions, or for damages resulting from
17 .\" the use of the information contained herein.  The author(s) may not
18 .\" have taken the same level of care in the production of this manual,
19 .\" which is licensed free of charge, as they might when working
20 .\" professionally.
21 .\"
22 .\" Formatted or processed versions of this manual, if unaccompanied by
23 .\" the source, must acknowledge the copyright and authors of this work.
24 .\"
25 .\" References consulted:
26 .\"     Linux libc source code
27 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
28 .\"     386BSD man pages
29 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
30 .\" Modified 1995-08-14 by Arnt Gulbrandsen <agulbra@troll.no>
31 .\" Modified 2002-07-27 by Walter Harms
32 .\"     (walter.harms@informatik.uni-oldenburg.de)
33 .\"
34 .\" Japanese Version Copyright (c) 2003  Akihiro MOTOKI
35 .\"         all rights reserved.
36 .\" Translated Wed Aug  6 00:35:20 JST 2003
37 .\"         by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
38 .\" Updated 2008-09-16, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
39 .\"
40 .TH LOG 3  2010-09-20  "" "Linux Programmer's Manual"
41 .SH 名前
42 log, logf, logl \- 自然対数関数
43 .SH 書式
44 .nf
45 .B #include <math.h>
46 .sp
47 .BI "double log(double " x );
48 .br
49 .BI "float logf(float " x );
50 .br
51 .BI "long double logl(long double " x );
52 .fi
53 .sp
54 \fI\-lm\fP でリンクする。
55 .sp
56 .in -4n
57 glibc 向けの機能検査マクロの要件
58 .RB ( feature_test_macros (7)
59 参照):
60 .in
61 .sp
62 .ad l
63 .BR logf (),
64 .BR logl ():
65 .RS 4
66 _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 600 || _ISOC99_SOURCE ||
67 _POSIX_C_SOURCE\ >=\ 200112L;
68 .br
69 or
70 .I cc\ -std=c99
71 .RE
72 .ad
73 .SH 説明
74 .BR log ()
75 関数は \fIx\fP の自然対数を返す。
76 .SH 返り値
77 成功すると、これらの関数は
78 .I x
79 の自然対数を返す。
80
81 .I x
82 が NaN の場合、NaN が返される。
83
84 .I x
85 が 1 の場合、+0 が返される。
86
87 .I x
88 が正の無限大の場合、正の無限大が返される。
89
90 .I x
91 が 0 の場合、極エラー (pole error) が発生し、
92 各関数はそれぞれ
93 .RB - HUGE_VAL ,
94 .RB - HUGE_VALF ,
95 .RB - HUGE_VALL
96 を返す。
97
98 .I x
99 が負の場合 (負の無限大も含む)、領域エラー (domain error) が発生し、
100 NaN (not a number) が返される。
101 .SH エラー
102 これらの関数を呼び出した際にエラーが発生したかの判定方法についての情報は
103 .BR math_error (7)
104 を参照のこと。
105 .PP
106 以下のエラーが発生する可能性がある。
107 .TP
108 領域エラー (domain error): \fIx\fP が負である
109 .I errno
110
111 .B EDOM
112 が設定される。
113 不正 (invalid) 浮動小数点例外
114 .RB ( FE_INVALID )
115 が上がる。
116 .TP
117 極エラー (pole error): \fIx\fP が 0 である
118 .I errno
119
120 .B ERANGE
121 が設定される。
122 0 による除算 (divide-by-zero) 浮動小数点例外
123 .RB ( FE_DIVBYZERO )
124 が上がる。
125 .SH 準拠
126 C99, POSIX.1-2001.
127 .I double
128 版の関数は SVr4, 4.3BSD, C89 にも準拠している。
129 .SH バグ
130 glibc 2.5 以前では、
131 NaN に対して
132 .BR log ()
133 をとると、間違って不正浮動小数点例外
134 .RB ( FE_INVALID )
135 が発生していた。
136 .SH 関連項目
137 .BR cbrt (3),
138 .BR clog (3),
139 .BR log10 (3),
140 .BR log1p (3),
141 .BR log2 (3),
142 .BR sqrt (3)