std::comp_e...p_ellint_1l(3)
π std::comp_ellint_1, std::comp_ellint_1f, std::comp_ellint_1l π
okay so bestie, welcome to the <cmath> corner of the C++ Standard Libary manual β yes, βLibaryβ is exactly how the page header spells it, no cap. The page title is std::comp_e...p_ellint_1l(3) (that ellipsis is the pageβs own abbreviation, not me being shady). Weβre talking about the complete elliptic integral of the first kind, and honestly? kinda iconic. π
πΈ NAME πΈ
std::comp_ellint_1, std::comp_ellint_1f, std::comp_ellint_1l β the whole trio, together, slaying in <cmath>. β¨
β¨ Synopsis β¨
Hereβs the signature lineup, verbatim so nobody gets lost:
double comp_ellint_1( double arg );
double comp_ellint_1( float arg );
double comp_ellint_1( long double arg ); (1)
float comp_ellint_1f( float arg );
long double comp_ellint_1l( long double arg );
double comp_ellint_1( IntegralType arg ); (2)
- Computes the complete elliptic integral of the first kind of
arg. - A set of overloads or a function template accepting an argument of any integral type. Equivalent to (1) after casting the argument to
double.
β οΈ Important vibe check: as all special functions,comp_ellint_1is only guaranteed to be available in<cmath>if__STDCPP_MATH_SPEC_FUNCS__is defined by the implementation to a value at least201003Land if the user defines__STDCPP_WANT_MATH_SPEC_FUNCS__before including any standard library headers.
π«Ά Parameters π«Ά
argβ value of a floating-point or integral type.
π Return value π
If no errors occur, the value of the complete elliptic integral of the first kind of arg, that is ellint_1(arg, Ο/2), is returned. π
π¦ Error handling π¦
Errors may be reported as specified in math_errhandling.
- If the argument is
NaN,NaNis returned and domain error is not reported. - If
|arg| > 1, a domain error may occur.
π Notes π
Implementations that do not support TR 29124 but support TR 19768 provide this function in the header tr1/cmath and namespace std::tr1.
An implementation of this function is also available in boost.math.
π§ͺ Example π§ͺ
The page says it works as shown with gcc 6.0, and it cues the snippet with // Run this code β so go off, bestie:
#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include <cmath>
#include <iostream>
int main()
{
double hpi = std::acos(-1) / 2;
std::cout << "K(0) = " << std::comp_ellint_1(0) << '\n'
<< "Ο/2 = " << hpi << '\n'
<< "K(0.5) = " << std::comp_ellint_1(0.5) << '\n'
<< "F(0.5, Ο/2) = " << std::ellint_1(0.5, hpi) << '\n';
}
Output
K(0) = 1.5708
Ο/2 = 1.5708
K(0.5) = 1.68575
F(0.5, Ο/2) = 1.68575
π External links π
Weisstein, Eric W. "Complete Elliptic Integral of the First Kind." From MathWorld--A Wolfram Web Resource.
π See also π
ellint_1(incomplete) elliptic integral of the first kindellint_1f(function)ellint_1l
okay thatβs the whole page, bestie. source/version: http://cppreference.com Β· date: 2024.06.10 Β· title vibe: std::comp_e...p_ellint_1l(3) β mwah πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms