From Jason Turner

[c.math]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp2oyjsq7i/{from.md → to.md} +219 -360
tmp/tmp2oyjsq7i/{from.md → to.md} RENAMED
@@ -27,600 +27,457 @@ namespace std {
27
  #define MATH_ERREXCEPT see below
28
 
29
  #define math_errhandling see below
30
 
31
  namespace std {
32
- float acos(float x); // see [library.c]
33
- double acos(double x);
34
- long double acos(long double x); // see [library.c]
35
  float acosf(float x);
36
  long double acosl(long double x);
37
 
38
- float asin(float x); // see [library.c]
39
- double asin(double x);
40
- long double asin(long double x); // see [library.c]
41
  float asinf(float x);
42
  long double asinl(long double x);
43
 
44
- float atan(float x); // see [library.c]
45
- double atan(double x);
46
- long double atan(long double x); // see [library.c]
47
  float atanf(float x);
48
  long double atanl(long double x);
49
 
50
- float atan2(float y, float x); // see [library.c]
51
- double atan2(double y, double x);
52
- long double atan2(long double y, long double x); // see [library.c]
53
  float atan2f(float y, float x);
54
  long double atan2l(long double y, long double x);
55
 
56
- float cos(float x); // see [library.c]
57
- double cos(double x);
58
- long double cos(long double x); // see [library.c]
59
  float cosf(float x);
60
  long double cosl(long double x);
61
 
62
- float sin(float x); // see [library.c]
63
- double sin(double x);
64
- long double sin(long double x); // see [library.c]
65
  float sinf(float x);
66
  long double sinl(long double x);
67
 
68
- float tan(float x); // see [library.c]
69
- double tan(double x);
70
- long double tan(long double x); // see [library.c]
71
  float tanf(float x);
72
  long double tanl(long double x);
73
 
74
- float acosh(float x); // see [library.c]
75
- double acosh(double x);
76
- long double acosh(long double x); // see [library.c]
77
  float acoshf(float x);
78
  long double acoshl(long double x);
79
 
80
- float asinh(float x); // see [library.c]
81
- double asinh(double x);
82
- long double asinh(long double x); // see [library.c]
83
  float asinhf(float x);
84
  long double asinhl(long double x);
85
 
86
- float atanh(float x); // see [library.c]
87
- double atanh(double x);
88
- long double atanh(long double x); // see [library.c]
89
  float atanhf(float x);
90
  long double atanhl(long double x);
91
 
92
- float cosh(float x); // see [library.c]
93
- double cosh(double x);
94
- long double cosh(long double x); // see [library.c]
95
  float coshf(float x);
96
  long double coshl(long double x);
97
 
98
- float sinh(float x); // see [library.c]
99
- double sinh(double x);
100
- long double sinh(long double x); // see [library.c]
101
  float sinhf(float x);
102
  long double sinhl(long double x);
103
 
104
- float tanh(float x); // see [library.c]
105
- double tanh(double x);
106
- long double tanh(long double x); // see [library.c]
107
  float tanhf(float x);
108
  long double tanhl(long double x);
109
 
110
- float exp(float x); // see [library.c]
111
- double exp(double x);
112
- long double exp(long double x); // see [library.c]
113
  float expf(float x);
114
  long double expl(long double x);
115
 
116
- float exp2(float x); // see [library.c]
117
- double exp2(double x);
118
- long double exp2(long double x); // see [library.c]
119
  float exp2f(float x);
120
  long double exp2l(long double x);
121
 
122
- float expm1(float x); // see [library.c]
123
- double expm1(double x);
124
- long double expm1(long double x); // see [library.c]
125
  float expm1f(float x);
126
  long double expm1l(long double x);
127
 
128
- float frexp(float value, int* exp); // see [library.c]
129
- double frexp(double value, int* exp);
130
- long double frexp(long double value, int* exp); // see [library.c]
131
- float frexpf(float value, int* exp);
132
- long double frexpl(long double value, int* exp);
133
 
134
- int ilogb(float x); // see [library.c]
135
- int ilogb(double x);
136
- int ilogb(long double x); // see [library.c]
137
- int ilogbf(float x);
138
- int ilogbl(long double x);
139
 
140
- float ldexp(float x, int exp); // see [library.c]
141
- double ldexp(double x, int exp);
142
- long double ldexp(long double x, int exp); // see [library.c]
143
- float ldexpf(float x, int exp);
144
- long double ldexpl(long double x, int exp);
145
 
146
- float log(float x); // see [library.c]
147
- double log(double x);
148
- long double log(long double x); // see [library.c]
149
  float logf(float x);
150
  long double logl(long double x);
151
 
152
- float log10(float x); // see [library.c]
153
- double log10(double x);
154
- long double log10(long double x); // see [library.c]
155
  float log10f(float x);
156
  long double log10l(long double x);
157
 
158
- float log1p(float x); // see [library.c]
159
- double log1p(double x);
160
- long double log1p(long double x); // see [library.c]
161
  float log1pf(float x);
162
  long double log1pl(long double x);
163
 
164
- float log2(float x); // see [library.c]
165
- double log2(double x);
166
- long double log2(long double x); // see [library.c]
167
  float log2f(float x);
168
  long double log2l(long double x);
169
 
170
- float logb(float x); // see [library.c]
171
- double logb(double x);
172
- long double logb(long double x); // see [library.c]
173
- float logbf(float x);
174
- long double logbl(long double x);
175
 
176
- float modf(float value, float* iptr); // see [library.c]
177
- double modf(double value, double* iptr);
178
- long double modf(long double value, long double* iptr); // see [library.c]
179
- float modff(float value, float* iptr);
180
- long double modfl(long double value, long double* iptr);
181
 
182
- float scalbn(float x, int n); // see [library.c]
183
- double scalbn(double x, int n);
184
- long double scalbn(long double x, int n); // see [library.c]
185
- float scalbnf(float x, int n);
186
- long double scalbnl(long double x, int n);
187
 
188
- float scalbln(float x, long int n); // see [library.c]
189
- double scalbln(double x, long int n);
190
- long double scalbln(long double x, long int n); // see [library.c]
191
- float scalblnf(float x, long int n);
192
- long double scalblnl(long double x, long int n);
193
 
194
- float cbrt(float x); // see [library.c]
195
- double cbrt(double x);
196
- long double cbrt(long double x); // see [library.c]
197
  float cbrtf(float x);
198
  long double cbrtl(long double x);
199
 
200
  // [c.math.abs], absolute values
201
- int abs(int j);
202
- long int abs(long int j);
203
- long long int abs(long long int j);
204
- float abs(float j);
205
- double abs(double j);
206
- long double abs(long double j);
207
 
208
- float fabs(float x); // see [library.c]
209
- double fabs(double x);
210
- long double fabs(long double x); // see [library.c]
211
- float fabsf(float x);
212
- long double fabsl(long double x);
213
 
214
- float hypot(float x, float y); // see [library.c]
215
- double hypot(double x, double y);
216
- long double hypot(long double x, long double y); // see [library.c]
217
  float hypotf(float x, float y);
218
  long double hypotl(long double x, long double y);
219
 
220
  // [c.math.hypot3], three-dimensional hypotenuse
221
- float hypot(float x, float y, float z);
222
- double hypot(double x, double y, double z);
223
- long double hypot(long double x, long double y, long double z);
224
 
225
- float pow(float x, float y); // see [library.c]
226
- double pow(double x, double y);
227
- long double pow(long double x, long double y); // see [library.c]
228
  float powf(float x, float y);
229
  long double powl(long double x, long double y);
230
 
231
- float sqrt(float x); // see [library.c]
232
- double sqrt(double x);
233
- long double sqrt(long double x); // see [library.c]
234
  float sqrtf(float x);
235
  long double sqrtl(long double x);
236
 
237
- float erf(float x); // see [library.c]
238
- double erf(double x);
239
- long double erf(long double x); // see [library.c]
240
  float erff(float x);
241
  long double erfl(long double x);
242
 
243
- float erfc(float x); // see [library.c]
244
- double erfc(double x);
245
- long double erfc(long double x); // see [library.c]
246
  float erfcf(float x);
247
  long double erfcl(long double x);
248
 
249
- float lgamma(float x); // see [library.c]
250
- double lgamma(double x);
251
- long double lgamma(long double x); // see [library.c]
252
  float lgammaf(float x);
253
  long double lgammal(long double x);
254
 
255
- float tgamma(float x); // see [library.c]
256
- double tgamma(double x);
257
- long double tgamma(long double x); // see [library.c]
258
  float tgammaf(float x);
259
  long double tgammal(long double x);
260
 
261
- float ceil(float x); // see [library.c]
262
- double ceil(double x);
263
- long double ceil(long double x); // see [library.c]
264
- float ceilf(float x);
265
- long double ceill(long double x);
266
 
267
- float floor(float x); // see [library.c]
268
- double floor(double x);
269
- long double floor(long double x); // see [library.c]
270
- float floorf(float x);
271
- long double floorl(long double x);
272
 
273
- float nearbyint(float x); // see [library.c]
274
- double nearbyint(double x);
275
- long double nearbyint(long double x); // see [library.c]
276
  float nearbyintf(float x);
277
  long double nearbyintl(long double x);
278
 
279
- float rint(float x); // see [library.c]
280
- double rint(double x);
281
- long double rint(long double x); // see [library.c]
282
  float rintf(float x);
283
  long double rintl(long double x);
284
 
285
- long int lrint(float x); // see [library.c]
286
- long int lrint(double x);
287
- long int lrint(long double x); // see [library.c]
288
  long int lrintf(float x);
289
  long int lrintl(long double x);
290
 
291
- long long int llrint(float x); // see [library.c]
292
- long long int llrint(double x);
293
- long long int llrint(long double x); // see [library.c]
294
  long long int llrintf(float x);
295
  long long int llrintl(long double x);
296
 
297
- float round(float x); // see [library.c]
298
- double round(double x);
299
- long double round(long double x); // see [library.c]
300
- float roundf(float x);
301
- long double roundl(long double x);
302
 
303
- long int lround(float x); // see [library.c]
304
- long int lround(double x);
305
- long int lround(long double x); // see [library.c]
306
- long int lroundf(float x);
307
- long int lroundl(long double x);
308
 
309
- long long int llround(float x); // see [library.c]
310
- long long int llround(double x);
311
- long long int llround(long double x); // see [library.c]
312
- long long int llroundf(float x);
313
- long long int llroundl(long double x);
314
 
315
- float trunc(float x); // see [library.c]
316
- double trunc(double x);
317
- long double trunc(long double x); // see [library.c]
318
- float truncf(float x);
319
- long double truncl(long double x);
320
 
321
- float fmod(float x, float y); // see [library.c]
322
- double fmod(double x, double y);
323
- long double fmod(long double x, long double y); // see [library.c]
324
- float fmodf(float x, float y);
325
- long double fmodl(long double x, long double y);
326
 
327
- float remainder(float x, float y); // see [library.c]
328
- double remainder(double x, double y);
329
- long double remainder(long double x, long double y); // see [library.c]
330
- float remainderf(float x, float y);
331
- long double remainderl(long double x, long double y);
332
 
333
- float remquo(float x, float y, int* quo); // see [library.c]
334
- double remquo(double x, double y, int* quo);
335
- long double remquo(long double x, long double y, int* quo); // see [library.c]
336
- float remquof(float x, float y, int* quo);
337
- long double remquol(long double x, long double y, int* quo);
338
 
339
- float copysign(float x, float y); // see [library.c]
340
- double copysign(double x, double y);
341
- long double copysign(long double x, long double y); // see [library.c]
342
- float copysignf(float x, float y);
343
- long double copysignl(long double x, long double y);
344
 
345
  double nan(const char* tagp);
346
  float nanf(const char* tagp);
347
  long double nanl(const char* tagp);
348
 
349
- float nextafter(float x, float y); // see [library.c]
350
- double nextafter(double x, double y);
351
- long double nextafter(long double x, long double y); // see [library.c]
352
- float nextafterf(float x, float y);
353
- long double nextafterl(long double x, long double y);
354
 
355
- float nexttoward(float x, long double y); // see [library.c]
356
- double nexttoward(double x, long double y);
357
- long double nexttoward(long double x, long double y); // see [library.c]
358
- float nexttowardf(float x, long double y);
359
- long double nexttowardl(long double x, long double y);
360
 
361
- float fdim(float x, float y); // see [library.c]
362
- double fdim(double x, double y);
363
- long double fdim(long double x, long double y); // see [library.c]
364
- float fdimf(float x, float y);
365
- long double fdiml(long double x, long double y);
366
 
367
- float fmax(float x, float y); // see [library.c]
368
- double fmax(double x, double y);
369
- long double fmax(long double x, long double y); // see [library.c]
370
- float fmaxf(float x, float y);
371
- long double fmaxl(long double x, long double y);
372
 
373
- float fmin(float x, float y); // see [library.c]
374
- double fmin(double x, double y);
375
- long double fmin(long double x, long double y); // see [library.c]
376
- float fminf(float x, float y);
377
- long double fminl(long double x, long double y);
378
 
379
- float fma(float x, float y, float z); // see [library.c]
380
- double fma(double x, double y, double z);
381
- long double fma(long double x, long double y, long double z); // see [library.c]
382
- float fmaf(float x, float y, float z);
383
- long double fmal(long double x, long double y, long double z);
384
 
385
  // [c.math.lerp], linear interpolation
386
- constexpr float lerp(float a, float b, float t) noexcept;
387
- constexpr double lerp(double a, double b, double t) noexcept;
388
- constexpr long double lerp(long double a, long double b, long double t) noexcept;
389
 
390
  // [c.math.fpclass], classification / comparison functions
391
- int fpclassify(float x);
392
- int fpclassify(double x);
393
- int fpclassify(long double x);
394
-
395
- bool isfinite(float x);
396
- bool isfinite(double x);
397
- bool isfinite(long double x);
398
-
399
- bool isinf(float x);
400
- bool isinf(double x);
401
- bool isinf(long double x);
402
-
403
- bool isnan(float x);
404
- bool isnan(double x);
405
- bool isnan(long double x);
406
-
407
- bool isnormal(float x);
408
- bool isnormal(double x);
409
- bool isnormal(long double x);
410
-
411
- bool signbit(float x);
412
- bool signbit(double x);
413
- bool signbit(long double x);
414
-
415
- bool isgreater(float x, float y);
416
- bool isgreater(double x, double y);
417
- bool isgreater(long double x, long double y);
418
-
419
- bool isgreaterequal(float x, float y);
420
- bool isgreaterequal(double x, double y);
421
- bool isgreaterequal(long double x, long double y);
422
-
423
- bool isless(float x, float y);
424
- bool isless(double x, double y);
425
- bool isless(long double x, long double y);
426
-
427
- bool islessequal(float x, float y);
428
- bool islessequal(double x, double y);
429
- bool islessequal(long double x, long double y);
430
-
431
- bool islessgreater(float x, float y);
432
- bool islessgreater(double x, double y);
433
- bool islessgreater(long double x, long double y);
434
-
435
- bool isunordered(float x, float y);
436
- bool isunordered(double x, double y);
437
- bool isunordered(long double x, long double y);
438
 
439
  // [sf.cmath], mathematical special functions
440
 
441
  // [sf.cmath.assoc.laguerre], associated Laguerre polynomials
442
- double assoc_laguerre(unsigned n, unsigned m, double x);
443
  float assoc_laguerref(unsigned n, unsigned m, float x);
444
  long double assoc_laguerrel(unsigned n, unsigned m, long double x);
445
 
446
  // [sf.cmath.assoc.legendre], associated Legendre functions
447
- double assoc_legendre(unsigned l, unsigned m, double x);
448
  float assoc_legendref(unsigned l, unsigned m, float x);
449
  long double assoc_legendrel(unsigned l, unsigned m, long double x);
450
 
451
  // [sf.cmath.beta], beta function
452
- double beta(double x, double y);
453
  float betaf(float x, float y);
454
  long double betal(long double x, long double y);
455
 
456
  // [sf.cmath.comp.ellint.1], complete elliptic integral of the first kind
457
- double comp_ellint_1(double k);
458
  float comp_ellint_1f(float k);
459
  long double comp_ellint_1l(long double k);
460
 
461
  // [sf.cmath.comp.ellint.2], complete elliptic integral of the second kind
462
- double comp_ellint_2(double k);
463
  float comp_ellint_2f(float k);
464
  long double comp_ellint_2l(long double k);
465
 
466
  // [sf.cmath.comp.ellint.3], complete elliptic integral of the third kind
467
- double comp_ellint_3(double k, double nu);
468
  float comp_ellint_3f(float k, float nu);
469
  long double comp_ellint_3l(long double k, long double nu);
470
 
471
  // [sf.cmath.cyl.bessel.i], regular modified cylindrical Bessel functions
472
- double cyl_bessel_i(double nu, double x);
473
  float cyl_bessel_if(float nu, float x);
474
  long double cyl_bessel_il(long double nu, long double x);
475
 
476
  // [sf.cmath.cyl.bessel.j], cylindrical Bessel functions of the first kind
477
- double cyl_bessel_j(double nu, double x);
478
  float cyl_bessel_jf(float nu, float x);
479
  long double cyl_bessel_jl(long double nu, long double x);
480
 
481
  // [sf.cmath.cyl.bessel.k], irregular modified cylindrical Bessel functions
482
- double cyl_bessel_k(double nu, double x);
483
  float cyl_bessel_kf(float nu, float x);
484
  long double cyl_bessel_kl(long double nu, long double x);
485
 
486
- // [sf.cmath.cyl.neumann], cylindrical Neumann functions;
487
  // cylindrical Bessel functions of the second kind
488
- double cyl_neumann(double nu, double x);
489
  float cyl_neumannf(float nu, float x);
490
  long double cyl_neumannl(long double nu, long double x);
491
 
492
  // [sf.cmath.ellint.1], incomplete elliptic integral of the first kind
493
- double ellint_1(double k, double phi);
494
  float ellint_1f(float k, float phi);
495
  long double ellint_1l(long double k, long double phi);
496
 
497
  // [sf.cmath.ellint.2], incomplete elliptic integral of the second kind
498
- double ellint_2(double k, double phi);
499
  float ellint_2f(float k, float phi);
500
  long double ellint_2l(long double k, long double phi);
501
 
502
  // [sf.cmath.ellint.3], incomplete elliptic integral of the third kind
503
- double ellint_3(double k, double nu, double phi);
 
504
  float ellint_3f(float k, float nu, float phi);
505
  long double ellint_3l(long double k, long double nu, long double phi);
506
 
507
  // [sf.cmath.expint], exponential integral
508
- double expint(double x);
509
  float expintf(float x);
510
  long double expintl(long double x);
511
 
512
  // [sf.cmath.hermite], Hermite polynomials
513
- double hermite(unsigned n, double x);
514
  float hermitef(unsigned n, float x);
515
  long double hermitel(unsigned n, long double x);
516
 
517
  // [sf.cmath.laguerre], Laguerre polynomials
518
- double laguerre(unsigned n, double x);
519
  float laguerref(unsigned n, float x);
520
  long double laguerrel(unsigned n, long double x);
521
 
522
  // [sf.cmath.legendre], Legendre polynomials
523
- double legendre(unsigned l, double x);
524
  float legendref(unsigned l, float x);
525
  long double legendrel(unsigned l, long double x);
526
 
527
  // [sf.cmath.riemann.zeta], Riemann zeta function
528
- double riemann_zeta(double x);
529
  float riemann_zetaf(float x);
530
  long double riemann_zetal(long double x);
531
 
532
  // [sf.cmath.sph.bessel], spherical Bessel functions of the first kind
533
- double sph_bessel(unsigned n, double x);
534
  float sph_besself(unsigned n, float x);
535
  long double sph_bessell(unsigned n, long double x);
536
 
537
  // [sf.cmath.sph.legendre], spherical associated Legendre functions
538
- double sph_legendre(unsigned l, unsigned m, double theta);
539
  float sph_legendref(unsigned l, unsigned m, float theta);
540
  long double sph_legendrel(unsigned l, unsigned m, long double theta);
541
 
542
  // [sf.cmath.sph.neumann], spherical Neumann functions;
543
  // spherical Bessel functions of the second kind
544
- double sph_neumann(unsigned n, double x);
545
  float sph_neumannf(unsigned n, float x);
546
  long double sph_neumannl(unsigned n, long double x);
547
  }
548
  ```
549
 
550
  The contents and meaning of the header `<cmath>` are the same as the C
551
  standard library header `<math.h>`, with the addition of a
552
- three-dimensional hypotenuse function ([[c.math.hypot3]]) and the
553
- mathematical special functions described in [[sf.cmath]].
 
554
 
555
  [*Note 1*: Several functions have additional overloads in this
556
  document, but they have the same behavior as in the C standard library
557
  [[library.c]]. — *end note*]
558
 
559
- For each set of overloaded functions within `<cmath>`, with the
560
- exception of `abs`, there shall be additional overloads sufficient to
561
- ensure:
 
 
562
 
563
- - If any argument of arithmetic type corresponding to a `double`
564
- parameter has type `long double`, then all arguments of arithmetic
565
- type [[basic.fundamental]] corresponding to `double` parameters are
566
- effectively cast to `long double`.
567
- - Otherwise, if any argument of arithmetic type corresponding to a
568
- `double` parameter has type `double` or an integer type, then all
569
- arguments of arithmetic type corresponding to `double` parameters are
570
- effectively cast to `double`.
571
- - \[*Note 2*: Otherwise, all arguments of arithmetic type corresponding
572
- to `double` parameters have type `float`. *end note*]
 
 
573
 
574
- [*Note 3*: `abs` is exempted from these rules in order to stay
575
- compatible with C. *end note*]
 
576
 
577
- ISO C 7.12
578
 
579
  ### Absolute values <a id="c.math.abs">[[c.math.abs]]</a>
580
 
581
  [*Note 1*: The headers `<cstdlib>` and `<cmath>` declare the functions
582
  described in this subclause. — *end note*]
583
 
584
  ``` cpp
585
- int abs(int j);
586
- long int abs(long int j);
587
- long long int abs(long long int j);
588
- float abs(float j);
589
- double abs(double j);
590
- long double abs(long double j);
591
  ```
592
 
593
- *Effects:* The `abs` functions have the semantics specified in the C
594
- standard library for the functions `abs`, `labs`, `llabs`, `fabsf`,
595
- `fabs`, and `fabsl`.
596
 
597
- *Remarks:* If `abs()` is called with an argument of type `X` for which
598
  `is_unsigned_v<X>` is `true` and if `X` cannot be converted to `int` by
599
  integral promotion [[conv.prom]], the program is ill-formed.
600
 
601
  [*Note 1*: Arguments that can be promoted to `int` are permitted for
602
  compatibility with C. — *end note*]
603
 
 
 
 
 
 
 
604
  See also: ISO C 7.12.7.2, 7.22.6.1
605
 
606
  ### Three-dimensional hypotenuse <a id="c.math.hypot3">[[c.math.hypot3]]</a>
607
 
608
  ``` cpp
609
- float hypot(float x, float y, float z);
610
- double hypot(double x, double y, double z);
611
- long double hypot(long double x, long double y, long double z);
612
  ```
613
 
614
  *Returns:* $\sqrt{x^2+y^2+z^2}$.
615
 
616
  ### Linear interpolation <a id="c.math.lerp">[[c.math.lerp]]</a>
617
 
618
  ``` cpp
619
- constexpr float lerp(float a, float b, float t) noexcept;
620
- constexpr double lerp(double a, double b, double t) noexcept;
621
- constexpr long double lerp(long double a, long double b, long double t) noexcept;
622
  ```
623
 
624
  *Returns:* a+t(b-a).
625
 
626
  *Remarks:* Let `r` be the value returned. If
@@ -639,35 +496,36 @@ otherwise. For any `t1` and `t2`, the product of
639
 
640
  ### Classification / comparison functions <a id="c.math.fpclass">[[c.math.fpclass]]</a>
641
 
642
  The classification / comparison functions behave the same as the C
643
  macros with the corresponding names defined in the C standard library.
644
- Each function is overloaded for the three floating-point types.
645
 
646
- ISO C 7.12.3, 7.12.4
647
 
648
  ### Mathematical special functions <a id="sf.cmath">[[sf.cmath]]</a>
649
 
650
- If any argument value to any of the functions specified in this
651
- subclause is a NaN (Not a Number), the function shall return a NaN but
652
- it shall not report a domain error. Otherwise, the function shall report
653
- a domain error for just those argument values for which:
654
 
655
- - the function description’s *Returns:* clause explicitly specifies a
 
 
 
 
 
656
  domain and those argument values fall outside the specified domain, or
657
  - the corresponding mathematical function value has a nonzero imaginary
658
  component, or
659
  - the corresponding mathematical function is not mathematically
660
- defined.[^13]
661
 
662
  Unless otherwise specified, each function is defined for all finite
663
  values, for negative infinity, and for positive infinity.
664
 
665
  #### Associated Laguerre polynomials <a id="sf.cmath.assoc.laguerre">[[sf.cmath.assoc.laguerre]]</a>
666
 
667
  ``` cpp
668
- double assoc_laguerre(unsigned n, unsigned m, double x);
669
  float assoc_laguerref(unsigned n, unsigned m, float x);
670
  long double assoc_laguerrel(unsigned n, unsigned m, long double x);
671
  ```
672
 
673
  *Effects:* These functions compute the associated Laguerre polynomials
@@ -682,11 +540,11 @@ of their respective arguments `n`, `m`, and `x`.
682
  *implementation-defined* if `n >= 128` or if `m >= 128`.
683
 
684
  #### Associated Legendre functions <a id="sf.cmath.assoc.legendre">[[sf.cmath.assoc.legendre]]</a>
685
 
686
  ``` cpp
687
- double assoc_legendre(unsigned l, unsigned m, double x);
688
  float assoc_legendref(unsigned l, unsigned m, float x);
689
  long double assoc_legendrel(unsigned l, unsigned m, long double x);
690
  ```
691
 
692
  *Effects:* These functions compute the associated Legendre functions of
@@ -701,11 +559,11 @@ their respective arguments `l`, `m`, and `x`.
701
  *implementation-defined* if `l >= 128`.
702
 
703
  #### Beta function <a id="sf.cmath.beta">[[sf.cmath.beta]]</a>
704
 
705
  ``` cpp
706
- double beta(double x, double y);
707
  float betaf(float x, float y);
708
  long double betal(long double x, long double y);
709
  ```
710
 
711
  *Effects:* These functions compute the beta function of their respective
@@ -716,11 +574,11 @@ $$\mathsf{B}(x, y) = \frac{\Gamma(x) \, \Gamma(y)}{\Gamma(x + y)}
716
  \text{ ,\quad for $x > 0$,\, $y > 0$,}$$ where x is `x` and y is `y`.
717
 
718
  #### Complete elliptic integral of the first kind <a id="sf.cmath.comp.ellint.1">[[sf.cmath.comp.ellint.1]]</a>
719
 
720
  ``` cpp
721
- double comp_ellint_1(double k);
722
  float comp_ellint_1f(float k);
723
  long double comp_ellint_1l(long double k);
724
  ```
725
 
726
  *Effects:* These functions compute the complete elliptic integral of the
@@ -733,11 +591,11 @@ where k is `k`.
733
  See also [[sf.cmath.ellint.1]].
734
 
735
  #### Complete elliptic integral of the second kind <a id="sf.cmath.comp.ellint.2">[[sf.cmath.comp.ellint.2]]</a>
736
 
737
  ``` cpp
738
- double comp_ellint_2(double k);
739
  float comp_ellint_2f(float k);
740
  long double comp_ellint_2l(long double k);
741
  ```
742
 
743
  *Effects:* These functions compute the complete elliptic integral of the
@@ -750,11 +608,11 @@ where k is `k`.
750
  See also [[sf.cmath.ellint.2]].
751
 
752
  #### Complete elliptic integral of the third kind <a id="sf.cmath.comp.ellint.3">[[sf.cmath.comp.ellint.3]]</a>
753
 
754
  ``` cpp
755
- double comp_ellint_3(double k, double nu);
756
  float comp_ellint_3f(float k, float nu);
757
  long double comp_ellint_3l(long double k, long double nu);
758
  ```
759
 
760
  *Effects:* These functions compute the complete elliptic integral of the
@@ -767,11 +625,11 @@ where k is `k` and $\nu$ is `nu`.
767
  See also [[sf.cmath.ellint.3]].
768
 
769
  #### Regular modified cylindrical Bessel functions <a id="sf.cmath.cyl.bessel.i">[[sf.cmath.cyl.bessel.i]]</a>
770
 
771
  ``` cpp
772
- double cyl_bessel_i(double nu, double x);
773
  float cyl_bessel_if(float nu, float x);
774
  long double cyl_bessel_il(long double nu, long double x);
775
  ```
776
 
777
  *Effects:* These functions compute the regular modified cylindrical
@@ -788,11 +646,11 @@ Bessel functions of their respective arguments `nu` and `x`.
788
  See also [[sf.cmath.cyl.bessel.j]].
789
 
790
  #### Cylindrical Bessel functions of the first kind <a id="sf.cmath.cyl.bessel.j">[[sf.cmath.cyl.bessel.j]]</a>
791
 
792
  ``` cpp
793
- double cyl_bessel_j(double nu, double x);
794
  float cyl_bessel_jf(float nu, float x);
795
  long double cyl_bessel_jl(long double nu, long double x);
796
  ```
797
 
798
  *Effects:* These functions compute the cylindrical Bessel functions of
@@ -806,11 +664,11 @@ the first kind of their respective arguments `nu` and `x`.
806
  *implementation-defined* if `nu >= 128`.
807
 
808
  #### Irregular modified cylindrical Bessel functions <a id="sf.cmath.cyl.bessel.k">[[sf.cmath.cyl.bessel.k]]</a>
809
 
810
  ``` cpp
811
- double cyl_bessel_k(double nu, double x);
812
  float cyl_bessel_kf(float nu, float x);
813
  long double cyl_bessel_kl(long double nu, long double x);
814
  ```
815
 
816
  *Effects:* These functions compute the irregular modified cylindrical
@@ -846,11 +704,11 @@ See also [[sf.cmath.cyl.bessel.i]], [[sf.cmath.cyl.bessel.j]],
846
  [[sf.cmath.cyl.neumann]].
847
 
848
  #### Cylindrical Neumann functions <a id="sf.cmath.cyl.neumann">[[sf.cmath.cyl.neumann]]</a>
849
 
850
  ``` cpp
851
- double cyl_neumann(double nu, double x);
852
  float cyl_neumannf(float nu, float x);
853
  long double cyl_neumannl(long double nu, long double x);
854
  ```
855
 
856
  *Effects:* These functions compute the cylindrical Neumann functions,
@@ -880,11 +738,11 @@ their respective arguments `nu` and `x`.
880
  See also [[sf.cmath.cyl.bessel.j]].
881
 
882
  #### Incomplete elliptic integral of the first kind <a id="sf.cmath.ellint.1">[[sf.cmath.ellint.1]]</a>
883
 
884
  ``` cpp
885
- double ellint_1(double k, double phi);
886
  float ellint_1f(float k, float phi);
887
  long double ellint_1l(long double k, long double phi);
888
  ```
889
 
890
  *Effects:* These functions compute the incomplete elliptic integral of
@@ -896,11 +754,11 @@ measured in radians).
896
  \text{ ,\quad for $|k| \le 1$,}$$ where k is `k` and φ is `phi`.
897
 
898
  #### Incomplete elliptic integral of the second kind <a id="sf.cmath.ellint.2">[[sf.cmath.ellint.2]]</a>
899
 
900
  ``` cpp
901
- double ellint_2(double k, double phi);
902
  float ellint_2f(float k, float phi);
903
  long double ellint_2l(long double k, long double phi);
904
  ```
905
 
906
  *Effects:* These functions compute the incomplete elliptic integral of
@@ -912,11 +770,12 @@ $$\mathsf{E}(k, \phi) = \int_0^\phi \! \sqrt{1 - k^2 \sin^2 \theta} \, \mathsf{d
912
  \text{ ,\quad for $|k| \le 1$,}$$ where k is `k` and φ is `phi`.
913
 
914
  #### Incomplete elliptic integral of the third kind <a id="sf.cmath.ellint.3">[[sf.cmath.ellint.3]]</a>
915
 
916
  ``` cpp
917
- double ellint_3(double k, double nu, double phi);
 
918
  float ellint_3f(float k, float nu, float phi);
919
  long double ellint_3l(long double k, long double nu, long double phi);
920
  ```
921
 
922
  *Effects:* These functions compute the incomplete elliptic integral of
@@ -928,11 +787,11 @@ measured in radians).
928
  where $\nu$ is `nu`, k is `k`, and φ is `phi`.
929
 
930
  #### Exponential integral <a id="sf.cmath.expint">[[sf.cmath.expint]]</a>
931
 
932
  ``` cpp
933
- double expint(double x);
934
  float expintf(float x);
935
  long double expintl(long double x);
936
  ```
937
 
938
  *Effects:* These functions compute the exponential integral of their
@@ -945,11 +804,11 @@ respective arguments `x`.
945
  \;$$ where x is `x`.
946
 
947
  #### Hermite polynomials <a id="sf.cmath.hermite">[[sf.cmath.hermite]]</a>
948
 
949
  ``` cpp
950
- double hermite(unsigned n, double x);
951
  float hermitef(unsigned n, float x);
952
  long double hermitel(unsigned n, long double x);
953
  ```
954
 
955
  *Effects:* These functions compute the Hermite polynomials of their
@@ -965,11 +824,11 @@ respective arguments `n` and `x`.
965
  *implementation-defined* if `n >= 128`.
966
 
967
  #### Laguerre polynomials <a id="sf.cmath.laguerre">[[sf.cmath.laguerre]]</a>
968
 
969
  ``` cpp
970
- double laguerre(unsigned n, double x);
971
  float laguerref(unsigned n, float x);
972
  long double laguerrel(unsigned n, long double x);
973
  ```
974
 
975
  *Effects:* These functions compute the Laguerre polynomials of their
@@ -983,11 +842,11 @@ respective arguments `n` and `x`.
983
  *implementation-defined* if `n >= 128`.
984
 
985
  #### Legendre polynomials <a id="sf.cmath.legendre">[[sf.cmath.legendre]]</a>
986
 
987
  ``` cpp
988
- double legendre(unsigned l, double x);
989
  float legendref(unsigned l, float x);
990
  long double legendrel(unsigned l, long double x);
991
  ```
992
 
993
  *Effects:* These functions compute the Legendre polynomials of their
@@ -1002,11 +861,11 @@ respective arguments `l` and `x`.
1002
  *implementation-defined* if `l >= 128`.
1003
 
1004
  #### Riemann zeta function <a id="sf.cmath.riemann.zeta">[[sf.cmath.riemann.zeta]]</a>
1005
 
1006
  ``` cpp
1007
- double riemann_zeta(double x);
1008
  float riemann_zetaf(float x);
1009
  long double riemann_zetal(long double x);
1010
  ```
1011
 
1012
  *Effects:* These functions compute the Riemann zeta function of their
@@ -1036,11 +895,11 @@ respective arguments `x`.
1036
  \;$$ where x is `x`.
1037
 
1038
  #### Spherical Bessel functions of the first kind <a id="sf.cmath.sph.bessel">[[sf.cmath.sph.bessel]]</a>
1039
 
1040
  ``` cpp
1041
- double sph_bessel(unsigned n, double x);
1042
  float sph_besself(unsigned n, float x);
1043
  long double sph_bessell(unsigned n, long double x);
1044
  ```
1045
 
1046
  *Effects:* These functions compute the spherical Bessel functions of the
@@ -1056,11 +915,11 @@ where n is `n` and x is `x`.
1056
  See also [[sf.cmath.cyl.bessel.j]].
1057
 
1058
  #### Spherical associated Legendre functions <a id="sf.cmath.sph.legendre">[[sf.cmath.sph.legendre]]</a>
1059
 
1060
  ``` cpp
1061
- double sph_legendre(unsigned l, unsigned m, double theta);
1062
  float sph_legendref(unsigned l, unsigned m, float theta);
1063
  long double sph_legendrel(unsigned l, unsigned m, long double theta);
1064
  ```
1065
 
1066
  *Effects:* These functions compute the spherical associated Legendre
@@ -1080,11 +939,11 @@ is `theta`.
1080
  See also [[sf.cmath.assoc.legendre]].
1081
 
1082
  #### Spherical Neumann functions <a id="sf.cmath.sph.neumann">[[sf.cmath.sph.neumann]]</a>
1083
 
1084
  ``` cpp
1085
- double sph_neumann(unsigned n, double x);
1086
  float sph_neumannf(unsigned n, float x);
1087
  long double sph_neumannl(unsigned n, long double x);
1088
  ```
1089
 
1090
  *Effects:* These functions compute the spherical Neumann functions, also
 
27
  #define MATH_ERREXCEPT see below
28
 
29
  #define math_errhandling see below
30
 
31
  namespace std {
32
+ floating-point-type acos(floating-point-type x);
 
 
33
  float acosf(float x);
34
  long double acosl(long double x);
35
 
36
+ floating-point-type asin(floating-point-type x);
 
 
37
  float asinf(float x);
38
  long double asinl(long double x);
39
 
40
+ floating-point-type atan(floating-point-type x);
 
 
41
  float atanf(float x);
42
  long double atanl(long double x);
43
 
44
+ floating-point-type atan2(floating-point-type y, floating-point-type x);
 
 
45
  float atan2f(float y, float x);
46
  long double atan2l(long double y, long double x);
47
 
48
+ floating-point-type cos(floating-point-type x);
 
 
49
  float cosf(float x);
50
  long double cosl(long double x);
51
 
52
+ floating-point-type sin(floating-point-type x);
 
 
53
  float sinf(float x);
54
  long double sinl(long double x);
55
 
56
+ floating-point-type tan(floating-point-type x);
 
 
57
  float tanf(float x);
58
  long double tanl(long double x);
59
 
60
+ floating-point-type acosh(floating-point-type x);
 
 
61
  float acoshf(float x);
62
  long double acoshl(long double x);
63
 
64
+ floating-point-type asinh(floating-point-type x);
 
 
65
  float asinhf(float x);
66
  long double asinhl(long double x);
67
 
68
+ floating-point-type atanh(floating-point-type x);
 
 
69
  float atanhf(float x);
70
  long double atanhl(long double x);
71
 
72
+ floating-point-type cosh(floating-point-type x);
 
 
73
  float coshf(float x);
74
  long double coshl(long double x);
75
 
76
+ floating-point-type sinh(floating-point-type x);
 
 
77
  float sinhf(float x);
78
  long double sinhl(long double x);
79
 
80
+ floating-point-type tanh(floating-point-type x);
 
 
81
  float tanhf(float x);
82
  long double tanhl(long double x);
83
 
84
+ floating-point-type exp(floating-point-type x);
 
 
85
  float expf(float x);
86
  long double expl(long double x);
87
 
88
+ floating-point-type exp2(floating-point-type x);
 
 
89
  float exp2f(float x);
90
  long double exp2l(long double x);
91
 
92
+ floating-point-type expm1(floating-point-type x);
 
 
93
  float expm1f(float x);
94
  long double expm1l(long double x);
95
 
96
+ constexpr floating-point-type frexp(floating-point-type value, int* exp);
97
+ constexpr float frexpf(float value, int* exp);
98
+ constexpr long double frexpl(long double value, int* exp);
 
 
99
 
100
+ constexpr int ilogb(floating-point-type x);
101
+ constexpr int ilogbf(float x);
102
+ constexpr int ilogbl(long double x);
 
 
103
 
104
+ constexpr floating-point-type ldexp(floating-point-type x, int exp);
105
+ constexpr float ldexpf(float x, int exp);
106
+ constexpr long double ldexpl(long double x, int exp);
 
 
107
 
108
+ floating-point-type log(floating-point-type x);
 
 
109
  float logf(float x);
110
  long double logl(long double x);
111
 
112
+ floating-point-type log10(floating-point-type x);
 
 
113
  float log10f(float x);
114
  long double log10l(long double x);
115
 
116
+ floating-point-type log1p(floating-point-type x);
 
 
117
  float log1pf(float x);
118
  long double log1pl(long double x);
119
 
120
+ floating-point-type log2(floating-point-type x);
 
 
121
  float log2f(float x);
122
  long double log2l(long double x);
123
 
124
+ constexpr floating-point-type logb(floating-point-type x);
125
+ constexpr float logbf(float x);
126
+ constexpr long double logbl(long double x);
 
 
127
 
128
+ constexpr floating-point-type modf(floating-point-type value, floating-point-type* iptr);
129
+ constexpr float modff(float value, float* iptr);
130
+ constexpr long double modfl(long double value, long double* iptr);
 
 
131
 
132
+ constexpr floating-point-type scalbn(floating-point-type x, int n);
133
+ constexpr float scalbnf(float x, int n);
134
+ constexpr long double scalbnl(long double x, int n);
 
 
135
 
136
+ constexpr floating-point-type scalbln(floating-point-type x, long int n);
137
+ constexpr float scalblnf(float x, long int n);
138
+ constexpr long double scalblnl(long double x, long int n);
 
 
139
 
140
+ floating-point-type cbrt(floating-point-type x);
 
 
141
  float cbrtf(float x);
142
  long double cbrtl(long double x);
143
 
144
  // [c.math.abs], absolute values
145
+ constexpr int abs(int j);
146
+ constexpr long int abs(long int j);
147
+ constexpr long long int abs(long long int j);
148
+ constexpr floating-point-type abs(floating-point-type j);
 
 
149
 
150
+ constexpr floating-point-type fabs(floating-point-type x);
151
+ constexpr float fabsf(float x);
152
+ constexpr long double fabsl(long double x);
 
 
153
 
154
+ floating-point-type hypot(floating-point-type x, floating-point-type y);
 
 
155
  float hypotf(float x, float y);
156
  long double hypotl(long double x, long double y);
157
 
158
  // [c.math.hypot3], three-dimensional hypotenuse
159
+ floating-point-type hypot(floating-point-type x, floating-point-type y,
160
+ floating-point-type z);
 
161
 
162
+ floating-point-type pow(floating-point-type x, floating-point-type y);
 
 
163
  float powf(float x, float y);
164
  long double powl(long double x, long double y);
165
 
166
+ floating-point-type sqrt(floating-point-type x);
 
 
167
  float sqrtf(float x);
168
  long double sqrtl(long double x);
169
 
170
+ floating-point-type erf(floating-point-type x);
 
 
171
  float erff(float x);
172
  long double erfl(long double x);
173
 
174
+ floating-point-type erfc(floating-point-type x);
 
 
175
  float erfcf(float x);
176
  long double erfcl(long double x);
177
 
178
+ floating-point-type lgamma(floating-point-type x);
 
 
179
  float lgammaf(float x);
180
  long double lgammal(long double x);
181
 
182
+ floating-point-type tgamma(floating-point-type x);
 
 
183
  float tgammaf(float x);
184
  long double tgammal(long double x);
185
 
186
+ constexpr floating-point-type ceil(floating-point-type x);
187
+ constexpr float ceilf(float x);
188
+ constexpr long double ceill(long double x);
 
 
189
 
190
+ constexpr floating-point-type floor(floating-point-type x);
191
+ constexpr float floorf(float x);
192
+ constexpr long double floorl(long double x);
 
 
193
 
194
+ floating-point-type nearbyint(floating-point-type x);
 
 
195
  float nearbyintf(float x);
196
  long double nearbyintl(long double x);
197
 
198
+ floating-point-type rint(floating-point-type x);
 
 
199
  float rintf(float x);
200
  long double rintl(long double x);
201
 
202
+ long int lrint(floating-point-type x);
 
 
203
  long int lrintf(float x);
204
  long int lrintl(long double x);
205
 
206
+ long long int llrint(floating-point-type x);
 
 
207
  long long int llrintf(float x);
208
  long long int llrintl(long double x);
209
 
210
+ constexpr floating-point-type round(floating-point-type x);
211
+ constexpr float roundf(float x);
212
+ constexpr long double roundl(long double x);
 
 
213
 
214
+ constexpr long int lround(floating-point-type x);
215
+ constexpr long int lroundf(float x);
216
+ constexpr long int lroundl(long double x);
 
 
217
 
218
+ constexpr long long int llround(floating-point-type x);
219
+ constexpr long long int llroundf(float x);
220
+ constexpr long long int llroundl(long double x);
 
 
221
 
222
+ constexpr floating-point-type trunc(floating-point-type x);
223
+ constexpr float truncf(float x);
224
+ constexpr long double truncl(long double x);
 
 
225
 
226
+ constexpr floating-point-type fmod(floating-point-type x, floating-point-type y);
227
+ constexpr float fmodf(float x, float y);
228
+ constexpr long double fmodl(long double x, long double y);
 
 
229
 
230
+ constexpr floating-point-type remainder(floating-point-type x, floating-point-type y);
231
+ constexpr float remainderf(float x, float y);
232
+ constexpr long double remainderl(long double x, long double y);
 
 
233
 
234
+ constexpr floating-point-type remquo(floating-point-type x, floating-point-type y, int* quo);
235
+ constexpr float remquof(float x, float y, int* quo);
236
+ constexpr long double remquol(long double x, long double y, int* quo);
 
 
237
 
238
+ constexpr floating-point-type copysign(floating-point-type x, floating-point-type y);
239
+ constexpr float copysignf(float x, float y);
240
+ constexpr long double copysignl(long double x, long double y);
 
 
241
 
242
  double nan(const char* tagp);
243
  float nanf(const char* tagp);
244
  long double nanl(const char* tagp);
245
 
246
+ constexpr floating-point-type nextafter(floating-point-type x, floating-point-type y);
247
+ constexpr float nextafterf(float x, float y);
248
+ constexpr long double nextafterl(long double x, long double y);
 
 
249
 
250
+ constexpr floating-point-type nexttoward(floating-point-type x, long double y);
251
+ constexpr float nexttowardf(float x, long double y);
252
+ constexpr long double nexttowardl(long double x, long double y);
 
 
253
 
254
+ constexpr floating-point-type fdim(floating-point-type x, floating-point-type y);
255
+ constexpr float fdimf(float x, float y);
256
+ constexpr long double fdiml(long double x, long double y);
 
 
257
 
258
+ constexpr floating-point-type fmax(floating-point-type x, floating-point-type y);
259
+ constexpr float fmaxf(float x, float y);
260
+ constexpr long double fmaxl(long double x, long double y);
 
 
261
 
262
+ constexpr floating-point-type fmin(floating-point-type x, floating-point-type y);
263
+ constexpr float fminf(float x, float y);
264
+ constexpr long double fminl(long double x, long double y);
 
 
265
 
266
+ constexpr floating-point-type fma(floating-point-type x, floating-point-type y,
267
+ floating-point-type z);
268
+ constexpr float fmaf(float x, float y, float z);
269
+ constexpr long double fmal(long double x, long double y, long double z);
 
270
 
271
  // [c.math.lerp], linear interpolation
272
+ constexpr floating-point-type lerp(floating-point-type a, floating-point-type b,
273
+ floating-point-type t) noexcept;
 
274
 
275
  // [c.math.fpclass], classification / comparison functions
276
+ constexpr int fpclassify(floating-point-type x);
277
+ constexpr bool isfinite(floating-point-type x);
278
+ constexpr bool isinf(floating-point-type x);
279
+ constexpr bool isnan(floating-point-type x);
280
+ constexpr bool isnormal(floating-point-type x);
281
+ constexpr bool signbit(floating-point-type x);
282
+ constexpr bool isgreater(floating-point-type x, floating-point-type y);
283
+ constexpr bool isgreaterequal(floating-point-type x, floating-point-type y);
284
+ constexpr bool isless(floating-point-type x, floating-point-type y);
285
+ constexpr bool islessequal(floating-point-type x, floating-point-type y);
286
+ constexpr bool islessgreater(floating-point-type x, floating-point-type y);
287
+ constexpr bool isunordered(floating-point-type x, floating-point-type y);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
 
289
  // [sf.cmath], mathematical special functions
290
 
291
  // [sf.cmath.assoc.laguerre], associated Laguerre polynomials
292
+ floating-point-type assoc_laguerre(unsigned n, unsigned m, floating-point-type x);
293
  float assoc_laguerref(unsigned n, unsigned m, float x);
294
  long double assoc_laguerrel(unsigned n, unsigned m, long double x);
295
 
296
  // [sf.cmath.assoc.legendre], associated Legendre functions
297
+ floating-point-type assoc_legendre(unsigned l, unsigned m, floating-point-type x);
298
  float assoc_legendref(unsigned l, unsigned m, float x);
299
  long double assoc_legendrel(unsigned l, unsigned m, long double x);
300
 
301
  // [sf.cmath.beta], beta function
302
+ floating-point-type beta(floating-point-type x, floating-point-type y);
303
  float betaf(float x, float y);
304
  long double betal(long double x, long double y);
305
 
306
  // [sf.cmath.comp.ellint.1], complete elliptic integral of the first kind
307
+ floating-point-type comp_ellint_1(floating-point-type k);
308
  float comp_ellint_1f(float k);
309
  long double comp_ellint_1l(long double k);
310
 
311
  // [sf.cmath.comp.ellint.2], complete elliptic integral of the second kind
312
+ floating-point-type comp_ellint_2(floating-point-type k);
313
  float comp_ellint_2f(float k);
314
  long double comp_ellint_2l(long double k);
315
 
316
  // [sf.cmath.comp.ellint.3], complete elliptic integral of the third kind
317
+ floating-point-type comp_ellint_3(floating-point-type k, floating-point-type nu);
318
  float comp_ellint_3f(float k, float nu);
319
  long double comp_ellint_3l(long double k, long double nu);
320
 
321
  // [sf.cmath.cyl.bessel.i], regular modified cylindrical Bessel functions
322
+ floating-point-type cyl_bessel_i(floating-point-type nu, floating-point-type x);
323
  float cyl_bessel_if(float nu, float x);
324
  long double cyl_bessel_il(long double nu, long double x);
325
 
326
  // [sf.cmath.cyl.bessel.j], cylindrical Bessel functions of the first kind
327
+ floating-point-type cyl_bessel_j(floating-point-type nu, floating-point-type x);
328
  float cyl_bessel_jf(float nu, float x);
329
  long double cyl_bessel_jl(long double nu, long double x);
330
 
331
  // [sf.cmath.cyl.bessel.k], irregular modified cylindrical Bessel functions
332
+ floating-point-type cyl_bessel_k(floating-point-type nu, floating-point-type x);
333
  float cyl_bessel_kf(float nu, float x);
334
  long double cyl_bessel_kl(long double nu, long double x);
335
 
336
+ // [sf.cmath.cyl.neumann], cylindrical Neumann functions
337
  // cylindrical Bessel functions of the second kind
338
+ floating-point-type cyl_neumann(floating-point-type nu, floating-point-type x);
339
  float cyl_neumannf(float nu, float x);
340
  long double cyl_neumannl(long double nu, long double x);
341
 
342
  // [sf.cmath.ellint.1], incomplete elliptic integral of the first kind
343
+ floating-point-type ellint_1(floating-point-type k, floating-point-type phi);
344
  float ellint_1f(float k, float phi);
345
  long double ellint_1l(long double k, long double phi);
346
 
347
  // [sf.cmath.ellint.2], incomplete elliptic integral of the second kind
348
+ floating-point-type ellint_2(floating-point-type k, floating-point-type phi);
349
  float ellint_2f(float k, float phi);
350
  long double ellint_2l(long double k, long double phi);
351
 
352
  // [sf.cmath.ellint.3], incomplete elliptic integral of the third kind
353
+ floating-point-type ellint_3(floating-point-type k, floating-point-type nu,
354
+ floating-point-type phi);
355
  float ellint_3f(float k, float nu, float phi);
356
  long double ellint_3l(long double k, long double nu, long double phi);
357
 
358
  // [sf.cmath.expint], exponential integral
359
+ floating-point-type expint(floating-point-type x);
360
  float expintf(float x);
361
  long double expintl(long double x);
362
 
363
  // [sf.cmath.hermite], Hermite polynomials
364
+ floating-point-type hermite(unsigned n, floating-point-type x);
365
  float hermitef(unsigned n, float x);
366
  long double hermitel(unsigned n, long double x);
367
 
368
  // [sf.cmath.laguerre], Laguerre polynomials
369
+ floating-point-type laguerre(unsigned n, floating-point-type x);
370
  float laguerref(unsigned n, float x);
371
  long double laguerrel(unsigned n, long double x);
372
 
373
  // [sf.cmath.legendre], Legendre polynomials
374
+ floating-point-type legendre(unsigned l, floating-point-type x);
375
  float legendref(unsigned l, float x);
376
  long double legendrel(unsigned l, long double x);
377
 
378
  // [sf.cmath.riemann.zeta], Riemann zeta function
379
+ floating-point-type riemann_zeta(floating-point-type x);
380
  float riemann_zetaf(float x);
381
  long double riemann_zetal(long double x);
382
 
383
  // [sf.cmath.sph.bessel], spherical Bessel functions of the first kind
384
+ floating-point-type sph_bessel(unsigned n, floating-point-type x);
385
  float sph_besself(unsigned n, float x);
386
  long double sph_bessell(unsigned n, long double x);
387
 
388
  // [sf.cmath.sph.legendre], spherical associated Legendre functions
389
+ floating-point-type sph_legendre(unsigned l, unsigned m, floating-point-type theta);
390
  float sph_legendref(unsigned l, unsigned m, float theta);
391
  long double sph_legendrel(unsigned l, unsigned m, long double theta);
392
 
393
  // [sf.cmath.sph.neumann], spherical Neumann functions;
394
  // spherical Bessel functions of the second kind
395
+ floating-point-type sph_neumann(unsigned n, floating-point-type x);
396
  float sph_neumannf(unsigned n, float x);
397
  long double sph_neumannl(unsigned n, long double x);
398
  }
399
  ```
400
 
401
  The contents and meaning of the header `<cmath>` are the same as the C
402
  standard library header `<math.h>`, with the addition of a
403
+ three-dimensional hypotenuse function [[c.math.hypot3]], a linear
404
+ interpolation function [[c.math.lerp]], and the mathematical special
405
+ functions described in [[sf.cmath]].
406
 
407
  [*Note 1*: Several functions have additional overloads in this
408
  document, but they have the same behavior as in the C standard library
409
  [[library.c]]. — *end note*]
410
 
411
+ For each function with at least one parameter of type
412
+ *floating-point-type*, the implementation provides an overload for each
413
+ cv-unqualified floating-point type [[basic.fundamental]] where all uses
414
+ of *floating-point-type* in the function signature are replaced with
415
+ that floating-point type.
416
 
417
+ For each function with at least one parameter of type
418
+ *floating-point-type* other than `abs`, the implementation also provides
419
+ additional overloads sufficient to ensure that, if every argument
420
+ corresponding to a *floating-point-type* parameter has arithmetic type,
421
+ then every such argument is effectively cast to the floating-point type
422
+ with the greatest floating-point conversion rank and greatest
423
+ floating-point conversion subrank among the types of all such arguments,
424
+ where arguments of integer type are considered to have the same
425
+ floating-point conversion rank as `double`. If no such floating-point
426
+ type with the greatest rank and subrank exists, then overload resolution
427
+ does not result in a usable candidate [[over.match.general]] from the
428
+ overloads provided by the implementation.
429
 
430
+ An invocation of `nexttoward` is ill-formed if the argument
431
+ corresponding to the *floating-point-type* parameter has extended
432
+ floating-point type.
433
 
434
+ See also: ISO C 7.12
435
 
436
  ### Absolute values <a id="c.math.abs">[[c.math.abs]]</a>
437
 
438
  [*Note 1*: The headers `<cstdlib>` and `<cmath>` declare the functions
439
  described in this subclause. — *end note*]
440
 
441
  ``` cpp
442
+ constexpr int abs(int j);
443
+ constexpr long int abs(long int j);
444
+ constexpr long long int abs(long long int j);
 
 
 
445
  ```
446
 
447
+ *Effects:* These functions have the semantics specified in the C
448
+ standard library for the functions `abs`, `labs`, and `llabs`,
449
+ respectively.
450
 
451
+ *Remarks:* If `abs` is called with an argument of type `X` for which
452
  `is_unsigned_v<X>` is `true` and if `X` cannot be converted to `int` by
453
  integral promotion [[conv.prom]], the program is ill-formed.
454
 
455
  [*Note 1*: Arguments that can be promoted to `int` are permitted for
456
  compatibility with C. — *end note*]
457
 
458
+ ``` cpp
459
+ constexpr floating-point-type abs(floating-point-type x);
460
+ ```
461
+
462
+ *Returns:* The absolute value of `x`.
463
+
464
  See also: ISO C 7.12.7.2, 7.22.6.1
465
 
466
  ### Three-dimensional hypotenuse <a id="c.math.hypot3">[[c.math.hypot3]]</a>
467
 
468
  ``` cpp
469
+ floating-point-type hypot(floating-point-type x, floating-point-type y, floating-point-type z);
 
 
470
  ```
471
 
472
  *Returns:* $\sqrt{x^2+y^2+z^2}$.
473
 
474
  ### Linear interpolation <a id="c.math.lerp">[[c.math.lerp]]</a>
475
 
476
  ``` cpp
477
+ constexpr floating-point-type lerp(floating-point-type a, floating-point-type b,
478
+ floating-point-type t) noexcept;
 
479
  ```
480
 
481
  *Returns:* a+t(b-a).
482
 
483
  *Remarks:* Let `r` be the value returned. If
 
496
 
497
  ### Classification / comparison functions <a id="c.math.fpclass">[[c.math.fpclass]]</a>
498
 
499
  The classification / comparison functions behave the same as the C
500
  macros with the corresponding names defined in the C standard library.
 
501
 
502
+ See also: ISO C 7.12.3, 7.12.4
503
 
504
  ### Mathematical special functions <a id="sf.cmath">[[sf.cmath]]</a>
505
 
506
+ #### General <a id="sf.cmath.general">[[sf.cmath.general]]</a>
 
 
 
507
 
508
+ If any argument value to any of the functions specified in [[sf.cmath]]
509
+ is a NaN (Not a Number), the function shall return a NaN but it shall
510
+ not report a domain error. Otherwise, the function shall report a domain
511
+ error for just those argument values for which:
512
+
513
+ - the function description’s *Returns:* element explicitly specifies a
514
  domain and those argument values fall outside the specified domain, or
515
  - the corresponding mathematical function value has a nonzero imaginary
516
  component, or
517
  - the corresponding mathematical function is not mathematically
518
+ defined.[^14]
519
 
520
  Unless otherwise specified, each function is defined for all finite
521
  values, for negative infinity, and for positive infinity.
522
 
523
  #### Associated Laguerre polynomials <a id="sf.cmath.assoc.laguerre">[[sf.cmath.assoc.laguerre]]</a>
524
 
525
  ``` cpp
526
+ floating-point-type assoc_laguerre(unsigned n, unsigned m, floating-point-type x);
527
  float assoc_laguerref(unsigned n, unsigned m, float x);
528
  long double assoc_laguerrel(unsigned n, unsigned m, long double x);
529
  ```
530
 
531
  *Effects:* These functions compute the associated Laguerre polynomials
 
540
  *implementation-defined* if `n >= 128` or if `m >= 128`.
541
 
542
  #### Associated Legendre functions <a id="sf.cmath.assoc.legendre">[[sf.cmath.assoc.legendre]]</a>
543
 
544
  ``` cpp
545
+ floating-point-type assoc_legendre(unsigned l, unsigned m, floating-point-type x);
546
  float assoc_legendref(unsigned l, unsigned m, float x);
547
  long double assoc_legendrel(unsigned l, unsigned m, long double x);
548
  ```
549
 
550
  *Effects:* These functions compute the associated Legendre functions of
 
559
  *implementation-defined* if `l >= 128`.
560
 
561
  #### Beta function <a id="sf.cmath.beta">[[sf.cmath.beta]]</a>
562
 
563
  ``` cpp
564
+ floating-point-type beta(floating-point-type x, floating-point-type y);
565
  float betaf(float x, float y);
566
  long double betal(long double x, long double y);
567
  ```
568
 
569
  *Effects:* These functions compute the beta function of their respective
 
574
  \text{ ,\quad for $x > 0$,\, $y > 0$,}$$ where x is `x` and y is `y`.
575
 
576
  #### Complete elliptic integral of the first kind <a id="sf.cmath.comp.ellint.1">[[sf.cmath.comp.ellint.1]]</a>
577
 
578
  ``` cpp
579
+ floating-point-type comp_ellint_1(floating-point-type k);
580
  float comp_ellint_1f(float k);
581
  long double comp_ellint_1l(long double k);
582
  ```
583
 
584
  *Effects:* These functions compute the complete elliptic integral of the
 
591
  See also [[sf.cmath.ellint.1]].
592
 
593
  #### Complete elliptic integral of the second kind <a id="sf.cmath.comp.ellint.2">[[sf.cmath.comp.ellint.2]]</a>
594
 
595
  ``` cpp
596
+ floating-point-type comp_ellint_2(floating-point-type k);
597
  float comp_ellint_2f(float k);
598
  long double comp_ellint_2l(long double k);
599
  ```
600
 
601
  *Effects:* These functions compute the complete elliptic integral of the
 
608
  See also [[sf.cmath.ellint.2]].
609
 
610
  #### Complete elliptic integral of the third kind <a id="sf.cmath.comp.ellint.3">[[sf.cmath.comp.ellint.3]]</a>
611
 
612
  ``` cpp
613
+ floating-point-type comp_ellint_3(floating-point-type k, floating-point-type nu);
614
  float comp_ellint_3f(float k, float nu);
615
  long double comp_ellint_3l(long double k, long double nu);
616
  ```
617
 
618
  *Effects:* These functions compute the complete elliptic integral of the
 
625
  See also [[sf.cmath.ellint.3]].
626
 
627
  #### Regular modified cylindrical Bessel functions <a id="sf.cmath.cyl.bessel.i">[[sf.cmath.cyl.bessel.i]]</a>
628
 
629
  ``` cpp
630
+ floating-point-type cyl_bessel_i(floating-point-type nu, floating-point-type x);
631
  float cyl_bessel_if(float nu, float x);
632
  long double cyl_bessel_il(long double nu, long double x);
633
  ```
634
 
635
  *Effects:* These functions compute the regular modified cylindrical
 
646
  See also [[sf.cmath.cyl.bessel.j]].
647
 
648
  #### Cylindrical Bessel functions of the first kind <a id="sf.cmath.cyl.bessel.j">[[sf.cmath.cyl.bessel.j]]</a>
649
 
650
  ``` cpp
651
+ floating-point-type cyl_bessel_j(floating-point-type nu, floating-point-type x);
652
  float cyl_bessel_jf(float nu, float x);
653
  long double cyl_bessel_jl(long double nu, long double x);
654
  ```
655
 
656
  *Effects:* These functions compute the cylindrical Bessel functions of
 
664
  *implementation-defined* if `nu >= 128`.
665
 
666
  #### Irregular modified cylindrical Bessel functions <a id="sf.cmath.cyl.bessel.k">[[sf.cmath.cyl.bessel.k]]</a>
667
 
668
  ``` cpp
669
+ floating-point-type cyl_bessel_k(floating-point-type nu, floating-point-type x);
670
  float cyl_bessel_kf(float nu, float x);
671
  long double cyl_bessel_kl(long double nu, long double x);
672
  ```
673
 
674
  *Effects:* These functions compute the irregular modified cylindrical
 
704
  [[sf.cmath.cyl.neumann]].
705
 
706
  #### Cylindrical Neumann functions <a id="sf.cmath.cyl.neumann">[[sf.cmath.cyl.neumann]]</a>
707
 
708
  ``` cpp
709
+ floating-point-type cyl_neumann(floating-point-type nu, floating-point-type x);
710
  float cyl_neumannf(float nu, float x);
711
  long double cyl_neumannl(long double nu, long double x);
712
  ```
713
 
714
  *Effects:* These functions compute the cylindrical Neumann functions,
 
738
  See also [[sf.cmath.cyl.bessel.j]].
739
 
740
  #### Incomplete elliptic integral of the first kind <a id="sf.cmath.ellint.1">[[sf.cmath.ellint.1]]</a>
741
 
742
  ``` cpp
743
+ floating-point-type ellint_1(floating-point-type k, floating-point-type phi);
744
  float ellint_1f(float k, float phi);
745
  long double ellint_1l(long double k, long double phi);
746
  ```
747
 
748
  *Effects:* These functions compute the incomplete elliptic integral of
 
754
  \text{ ,\quad for $|k| \le 1$,}$$ where k is `k` and φ is `phi`.
755
 
756
  #### Incomplete elliptic integral of the second kind <a id="sf.cmath.ellint.2">[[sf.cmath.ellint.2]]</a>
757
 
758
  ``` cpp
759
+ floating-point-type ellint_2(floating-point-type k, floating-point-type phi);
760
  float ellint_2f(float k, float phi);
761
  long double ellint_2l(long double k, long double phi);
762
  ```
763
 
764
  *Effects:* These functions compute the incomplete elliptic integral of
 
770
  \text{ ,\quad for $|k| \le 1$,}$$ where k is `k` and φ is `phi`.
771
 
772
  #### Incomplete elliptic integral of the third kind <a id="sf.cmath.ellint.3">[[sf.cmath.ellint.3]]</a>
773
 
774
  ``` cpp
775
+ floating-point-type ellint_3(floating-point-type k, floating-point-type nu,
776
+ floating-point-type phi);
777
  float ellint_3f(float k, float nu, float phi);
778
  long double ellint_3l(long double k, long double nu, long double phi);
779
  ```
780
 
781
  *Effects:* These functions compute the incomplete elliptic integral of
 
787
  where $\nu$ is `nu`, k is `k`, and φ is `phi`.
788
 
789
  #### Exponential integral <a id="sf.cmath.expint">[[sf.cmath.expint]]</a>
790
 
791
  ``` cpp
792
+ floating-point-type expint(floating-point-type x);
793
  float expintf(float x);
794
  long double expintl(long double x);
795
  ```
796
 
797
  *Effects:* These functions compute the exponential integral of their
 
804
  \;$$ where x is `x`.
805
 
806
  #### Hermite polynomials <a id="sf.cmath.hermite">[[sf.cmath.hermite]]</a>
807
 
808
  ``` cpp
809
+ floating-point-type hermite(unsigned n, floating-point-type x);
810
  float hermitef(unsigned n, float x);
811
  long double hermitel(unsigned n, long double x);
812
  ```
813
 
814
  *Effects:* These functions compute the Hermite polynomials of their
 
824
  *implementation-defined* if `n >= 128`.
825
 
826
  #### Laguerre polynomials <a id="sf.cmath.laguerre">[[sf.cmath.laguerre]]</a>
827
 
828
  ``` cpp
829
+ floating-point-type laguerre(unsigned n, floating-point-type x);
830
  float laguerref(unsigned n, float x);
831
  long double laguerrel(unsigned n, long double x);
832
  ```
833
 
834
  *Effects:* These functions compute the Laguerre polynomials of their
 
842
  *implementation-defined* if `n >= 128`.
843
 
844
  #### Legendre polynomials <a id="sf.cmath.legendre">[[sf.cmath.legendre]]</a>
845
 
846
  ``` cpp
847
+ floating-point-type legendre(unsigned l, floating-point-type x);
848
  float legendref(unsigned l, float x);
849
  long double legendrel(unsigned l, long double x);
850
  ```
851
 
852
  *Effects:* These functions compute the Legendre polynomials of their
 
861
  *implementation-defined* if `l >= 128`.
862
 
863
  #### Riemann zeta function <a id="sf.cmath.riemann.zeta">[[sf.cmath.riemann.zeta]]</a>
864
 
865
  ``` cpp
866
+ floating-point-type riemann_zeta(floating-point-type x);
867
  float riemann_zetaf(float x);
868
  long double riemann_zetal(long double x);
869
  ```
870
 
871
  *Effects:* These functions compute the Riemann zeta function of their
 
895
  \;$$ where x is `x`.
896
 
897
  #### Spherical Bessel functions of the first kind <a id="sf.cmath.sph.bessel">[[sf.cmath.sph.bessel]]</a>
898
 
899
  ``` cpp
900
+ floating-point-type sph_bessel(unsigned n, floating-point-type x);
901
  float sph_besself(unsigned n, float x);
902
  long double sph_bessell(unsigned n, long double x);
903
  ```
904
 
905
  *Effects:* These functions compute the spherical Bessel functions of the
 
915
  See also [[sf.cmath.cyl.bessel.j]].
916
 
917
  #### Spherical associated Legendre functions <a id="sf.cmath.sph.legendre">[[sf.cmath.sph.legendre]]</a>
918
 
919
  ``` cpp
920
+ floating-point-type sph_legendre(unsigned l, unsigned m, floating-point-type theta);
921
  float sph_legendref(unsigned l, unsigned m, float theta);
922
  long double sph_legendrel(unsigned l, unsigned m, long double theta);
923
  ```
924
 
925
  *Effects:* These functions compute the spherical associated Legendre
 
939
  See also [[sf.cmath.assoc.legendre]].
940
 
941
  #### Spherical Neumann functions <a id="sf.cmath.sph.neumann">[[sf.cmath.sph.neumann]]</a>
942
 
943
  ``` cpp
944
+ floating-point-type sph_neumann(unsigned n, floating-point-type x);
945
  float sph_neumannf(unsigned n, float x);
946
  long double sph_neumannl(unsigned n, long double x);
947
  ```
948
 
949
  *Effects:* These functions compute the spherical Neumann functions, also