Skip to content

Commit 2b74fdd

Browse files
[libc++][NFC] Rearrange functions in synopsis comments of <cmath>
Currently, it's a bit hard to parse the `// C++17` comments nested in the `// C99` group. This patch attempts to sort functions into 4 groups. - C90: functions with names introduced in C89/90. - C99: functions with names introduced C99, including `f` and `l` variants of C89/90 functions, except for 3D `hypot`. - C++17: 3D `hypot` and C++17 math special functions. - C++20: C++20 `lerp`. The next group is expected to be C23, which will be added when C++ starts to merge C23 math functions. More `arithmetic` and `floating_point` are used for simplification.
1 parent fe07d9a commit 2b74fdd

File tree

1 file changed

+73
-55
lines changed

1 file changed

+73
-55
lines changed

libcxx/include/cmath

Lines changed: 73 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -46,112 +46,134 @@ Types:
4646
4747
floating_point abs(floating_point x);
4848
49-
floating_point acos (arithmetic x);
49+
floating_point acos(arithmetic x);
50+
51+
floating_point asin(arithmetic x);
52+
53+
floating_point atan(arithmetic x);
54+
55+
floating_point atan2(arithmetic y, arithmetic x);
56+
57+
floating_point ceil(arithmetic x);
58+
59+
floating_point cos(arithmetic x);
60+
61+
floating_point cosh(arithmetic x);
62+
63+
floating_point exp(arithmetic x);
64+
65+
floating_point fabs(arithmetic x);
66+
67+
floating_point floor(arithmetic x);
68+
69+
floating_point fmod(arithmetic x, arithmetic y);
70+
71+
floating_point frexp(arithmetic value, int* exp);
72+
73+
floating_point ldexp(arithmetic value, int exp);
74+
75+
floating_point log(arithmetic x);
76+
77+
floating_point modf(floating_point value, floating_point* iptr);
78+
79+
floating_point log10(arithmetic x);
80+
81+
floating_point pow(arithmetic x, arithmetic y);
82+
83+
floating_point sin(arithmetic x);
84+
85+
floating_point sinh(arithmetic x);
86+
87+
floating_point sqrt(arithmetic x);
88+
89+
floating_point tan(arithmetic x);
90+
91+
floating_point tanh(arithmetic x);
92+
93+
// C99
94+
95+
bool signbit(arithmetic x);
96+
97+
int fpclassify(arithmetic x);
98+
99+
bool isfinite(arithmetic x);
100+
bool isinf(arithmetic x);
101+
bool isnan(arithmetic x);
102+
bool isnormal(arithmetic x);
103+
104+
bool isgreater(arithmetic x, arithmetic y);
105+
bool isgreaterequal(arithmetic x, arithmetic y);
106+
bool isless(arithmetic x, arithmetic y);
107+
bool islessequal(arithmetic x, arithmetic y);
108+
bool islessgreater(arithmetic x, arithmetic y);
109+
bool isunordered(arithmetic x, arithmetic y);
110+
50111
float acosf(float x);
51112
long double acosl(long double x);
52113
53-
floating_point asin (arithmetic x);
54114
float asinf(float x);
55115
long double asinl(long double x);
56116
57-
floating_point atan (arithmetic x);
58117
float atanf(float x);
59118
long double atanl(long double x);
60119
61-
floating_point atan2 (arithmetic y, arithmetic x);
62120
float atan2f(float y, float x);
63121
long double atan2l(long double y, long double x);
64122
65-
floating_point ceil (arithmetic x);
66123
float ceilf(float x);
67124
long double ceill(long double x);
68125
69-
floating_point cos (arithmetic x);
70126
float cosf(float x);
71127
long double cosl(long double x);
72128
73-
floating_point cosh (arithmetic x);
74129
float coshf(float x);
75130
long double coshl(long double x);
76131
77-
floating_point exp (arithmetic x);
78132
float expf(float x);
79133
long double expl(long double x);
80134
81-
floating_point fabs (arithmetic x);
82135
float fabsf(float x);
83136
long double fabsl(long double x);
84137
85-
floating_point floor (arithmetic x);
86138
float floorf(float x);
87139
long double floorl(long double x);
88140
89-
floating_point fmod (arithmetic x, arithmetic y);
90141
float fmodf(float x, float y);
91142
long double fmodl(long double x, long double y);
92143
93-
floating_point frexp (arithmetic value, int* exp);
94144
float frexpf(float value, int* exp);
95145
long double frexpl(long double value, int* exp);
96146
97-
floating_point ldexp (arithmetic value, int exp);
98147
float ldexpf(float value, int exp);
99148
long double ldexpl(long double value, int exp);
100149
101-
floating_point log (arithmetic x);
102150
float logf(float x);
103151
long double logl(long double x);
104152
105-
floating_point log10 (arithmetic x);
106153
float log10f(float x);
107154
long double log10l(long double x);
108155
109-
floating_point modf (floating_point value, floating_point* iptr);
110156
float modff(float value, float* iptr);
111157
long double modfl(long double value, long double* iptr);
112158
113-
floating_point pow (arithmetic x, arithmetic y);
114159
float powf(float x, float y);
115160
long double powl(long double x, long double y);
116161
117-
floating_point sin (arithmetic x);
118162
float sinf(float x);
119163
long double sinl(long double x);
120164
121-
floating_point sinh (arithmetic x);
122165
float sinhf(float x);
123166
long double sinhl(long double x);
124167
125-
floating_point sqrt (arithmetic x);
126168
float sqrtf(float x);
127169
long double sqrtl(long double x);
128170
129-
floating_point tan (arithmetic x);
130171
float tanf(float x);
131172
long double tanl(long double x);
132173
133-
floating_point tanh (arithmetic x);
134174
float tanhf(float x);
135175
long double tanhl(long double x);
136176
137-
// C99
138-
139-
bool signbit(arithmetic x);
140-
141-
int fpclassify(arithmetic x);
142-
143-
bool isfinite(arithmetic x);
144-
bool isinf(arithmetic x);
145-
bool isnan(arithmetic x);
146-
bool isnormal(arithmetic x);
147-
148-
bool isgreater(arithmetic x, arithmetic y);
149-
bool isgreaterequal(arithmetic x, arithmetic y);
150-
bool isless(arithmetic x, arithmetic y);
151-
bool islessequal(arithmetic x, arithmetic y);
152-
bool islessgreater(arithmetic x, arithmetic y);
153-
bool isunordered(arithmetic x, arithmetic y);
154-
155177
floating_point acosh (arithmetic x);
156178
float acoshf(float x);
157179
long double acoshl(long double x);
@@ -204,22 +226,10 @@ floating_point fmin (arithmetic x, arithmetic y);
204226
float fminf(float x, float y);
205227
long double fminl(long double x, long double y);
206228
207-
double hermite(unsigned n, double x); // C++17
208-
float hermite(unsigned n, float x); // C++17
209-
long double hermite(unsigned n, long double x); // C++17
210-
float hermitef(unsigned n, float x); // C++17
211-
long double hermitel(unsigned n, long double x); // C++17
212-
template <class Integer>
213-
double hermite(unsigned n, Integer x); // C++17
214-
215229
floating_point hypot (arithmetic x, arithmetic y);
216230
float hypotf(float x, float y);
217231
long double hypotl(long double x, long double y);
218232
219-
double hypot(double x, double y, double z); // C++17
220-
float hypot(float x, float y, float z); // C++17
221-
long double hypot(long double x, long double y, long double z); // C++17
222-
223233
int ilogb (arithmetic x);
224234
int ilogbf(float x);
225235
int ilogbl(long double x);
@@ -304,9 +314,17 @@ floating_point trunc (arithmetic x);
304314
float truncf(float x);
305315
long double truncl(long double x);
306316
307-
constexpr float lerp(float a, float b, float t) noexcept; // C++20
308-
constexpr double lerp(double a, double b, double t) noexcept; // C++20
309-
constexpr long double lerp(long double a, long double b, long double t) noexcept; // C++20
317+
// C++17
318+
319+
floating_point hypot(arithmetic x, arithmetic y, arithmetic z);
320+
321+
floating_point hermite (unsigned n, arithmetic x);
322+
float hermitef(unsigned n, float x);
323+
long double hermitel(unsigned n, long double x);
324+
325+
// C++20
326+
327+
constexpr floating_point lerp(arithmetic a, arithmetic b, arithmetic t) noexcept;
310328
311329
} // std
312330

0 commit comments

Comments
 (0)