• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[section:c99 C99 C Functions]
2
3[h4 Supported C99 Functions]
4
5   namespace boost{ namespace math{ namespace tr1{ extern "C"{
6
7   typedef unspecified float_t;
8   typedef unspecified double_t;
9
10   double acosh(double x);
11   float acoshf(float x);
12   long double acoshl(long double x);
13
14   double asinh(double x);
15   float asinhf(float x);
16   long double asinhl(long double x);
17
18   double atanh(double x);
19   float atanhf(float x);
20   long double atanhl(long double x);
21
22   double cbrt(double x);
23   float cbrtf(float x);
24   long double cbrtl(long double x);
25
26   double copysign(double x, double y);
27   float copysignf(float x, float y);
28   long double copysignl(long double x, long double y);
29
30   double erf(double x);
31   float erff(float x);
32   long double erfl(long double x);
33
34   double erfc(double x);
35   float erfcf(float x);
36   long double erfcl(long double x);
37
38   double expm1(double x);
39   float expm1f(float x);
40   long double expm1l(long double x);
41
42   double fmax(double x, double y);
43   float fmaxf(float x, float y);
44   long double fmaxl(long double x, long double y);
45
46   double fmin(double x, double y);
47   float fminf(float x, float y);
48   long double fminl(long double x, long double y);
49
50   double hypot(double x, double y);
51   float hypotf(float x, float y);
52   long double hypotl(long double x, long double y);
53
54   double lgamma(double x);
55   float lgammaf(float x);
56   long double lgammal(long double x);
57
58   long long llround(double x);
59   long long llroundf(float x);
60   long long llroundl(long double x);
61
62   double log1p(double x);
63   float log1pf(float x);
64   long double log1pl(long double x);
65
66   long lround(double x);
67   long lroundf(float x);
68   long lroundl(long double x);
69
70   double nextafter(double x, double y);
71   float nextafterf(float x, float y);
72   long double nextafterl(long double x, long double y);
73
74   double nexttoward(double x, long double y);
75   float nexttowardf(float x, long double y);
76   long double nexttowardl(long double x, long double y);
77
78   double round(double x);
79   float roundf(float x);
80   long double roundl(long double x);
81
82   double tgamma(double x);
83   float tgammaf(float x);
84   long double tgammal(long double x);
85
86   double trunc(double x);
87   float truncf(float x);
88   long double truncl(long double x);
89
90   }}}} // namespaces
91
92In addition sufficient additional overloads of the `double` versions of the
93above functions are provided, so that calling the function with any mixture
94of `float`, `double`, `long double`, or /integer/ arguments is supported, with the
95return type determined by the __arg_promotion_rules.
96
97For example:
98
99   acoshf(2.0f);  // float version, returns float.
100   acosh(2.0f);   // also calls the float version and returns float.
101   acosh(2.0);    // double version, returns double.
102   acoshl(2.0L);  // long double version, returns a long double.
103   acosh(2.0L);   // also calls the long double version.
104   acosh(2);      // integer argument is treated as a double, returns double.
105
106[h4 Quick Reference]
107
108More detailed descriptions of these functions are available in the
109C99 standard.
110
111   typedef unspecified float_t;
112   typedef unspecified double_t;
113
114In this implementation `float_t` is the same as type `float`, and
115`double_t` the same as type `double` unless the preprocessor symbol
116FLT_EVAL_METHOD is defined, in which case these are set as follows:
117
118[table
119[[FLT_EVAL_METHOD][float_t][double_t]]
120[[0][float][double]]
121[[1][double][double]]
122[[2][long double][long double]]
123]
124
125   double acosh(double x);
126   float acoshf(float x);
127   long double acoshl(long double x);
128
129Returns the inverse hyperbolic cosine of /x/.
130
131See also __acosh for the full template (header only) version of this function.
132
133   double asinh(double x);
134   float asinhf(float x);
135   long double asinhl(long double x);
136
137Returns the inverse hyperbolic sine of /x/.
138
139See also __asinh for the full template (header only) version of this function.
140
141   double atanh(double x);
142   float atanhf(float x);
143   long double atanhl(long double x);
144
145Returns the inverse hyperbolic tangent of /x/.
146
147See also __atanh for the full template (header only) version of this function.
148
149   double cbrt(double x);
150   float cbrtf(float x);
151   long double cbrtl(long double x);
152
153Returns the cubed root of /x/.
154
155See also __cbrt for the full template (header only) version of this function.
156
157   double copysign(double x, double y);
158   float copysignf(float x, float y);
159   long double copysignl(long double x, long double y);
160
161Returns a value with the magnitude of /x/ and the sign of /y/.
162
163   double erf(double x);
164   float erff(float x);
165   long double erfl(long double x);
166
167Returns the error function of /x/:
168
169[equation erf1]
170
171See also __erf for the full template (header only) version of this function.
172
173   double erfc(double x);
174   float erfcf(float x);
175   long double erfcl(long double x);
176
177Returns the complementary error function of /x/ `1-erf(x)` without the loss
178of precision implied by the subtraction.
179
180See also __erfc for the full template (header only) version of this function.
181
182   double expm1(double x);
183   float expm1f(float x);
184   long double expm1l(long double x);
185
186Returns `exp(x)-1` without the loss
187of precision implied by the subtraction.
188
189See also __expm1 for the full template (header only) version of this function.
190
191   double fmax(double x, double y);
192   float fmaxf(float x, float y);
193   long double fmaxl(long double x, long double y);
194
195Returns the larger (most positive) of /x/ and /y/.
196
197   double fmin(double x, double y);
198   float fminf(float x, float y);
199   long double fminl(long double x, long double y);
200
201Returns the smaller (most negative) of /x/ and /y/.
202
203   double hypot(double x, double y);
204   float hypotf(float x, float y);
205   long double hypotl(long double x, long double y);
206
207Returns `sqrt(x*x + y*y)` without the danger of numeric overflow
208implied by that formulation.
209
210See also __hypot for the full template (header only) version of this function.
211
212   double lgamma(double x);
213   float lgammaf(float x);
214   long double lgammal(long double x);
215
216Returns the log of the gamma function of /x/.
217
218[equation lgamm1]
219
220See also __lgamma for the full template (header only) version of this function.
221
222   long long llround(double x);
223   long long llroundf(float x);
224   long long llroundl(long double x);
225
226Returns the value /x/ rounded to the nearest integer as a `long long`:
227equivalent to `floor(x + 0.5)`
228
229See also __llround for the full template (header only) version of this function.
230
231   double log1p(double x);
232   float log1pf(float x);
233   long double log1pl(long double x);
234
235Returns the `log(x+1)` without the loss of precision
236implied by that formulation.
237
238See also __log1p for the full template (header only) version of this function.
239
240   long lround(double x);
241   long lroundf(float x);
242   long lroundl(long double x);
243
244Returns the value /x/ rounded to the nearest integer as a `long`:
245equivalent to `floor(x + 0.5)`
246
247See also __lround for the full template (header only) version of this function.
248
249   double nextafter(double x, double y);
250   float nextafterf(float x, float y);
251   long double nextafterl(long double x, long double y);
252
253Returns the next representable floating point number after /x/
254in the direction of /y/, or /x/ if `x == y`.
255
256   double nexttoward(double x, long double y);
257   float nexttowardf(float x, long double y);
258   long double nexttowardl(long double x, long double y);
259
260As `nextafter`, but with /y/ always expressed as a `long double`.
261
262   double round(double x);
263   float roundf(float x);
264   long double roundl(long double x);
265
266Returns the value /x/ rounded to the nearest integer:
267equivalent to `floor(x + 0.5)`
268
269See also __round for the full template (header only) version of this function.
270
271   double tgamma(double x);
272   float tgammaf(float x);
273   long double tgammal(long double x);
274
275Returns the gamma function of /x/:
276
277[equation gamm1]
278
279See also __tgamma for the full template (header only) version of this function.
280
281   double trunc(double x);
282   float truncf(float x);
283   long double truncl(long double x);
284
285Returns /x/ truncated to the nearest integer.
286
287See also __trunc for the full template (header only) version of this function.
288
289See also [@http://www.open-std.org/JTC1/SC22/WG14/www/docs/n1124.pdf C99 ISO Standard]
290
291[endsect]
292
293[/
294  Copyright 2008 John Maddock and Paul A. Bristow.
295  Distributed under the Boost Software License, Version 1.0.
296  (See accompanying file LICENSE_1_0.txt or copy at
297  http://www.boost.org/LICENSE_1_0.txt).
298]
299
300