\documentclass[11pt]{amsart} \usepackage[a4paper,margin=2.5cm]{geometry} \usepackage{amsmath,amssymb,amsthm,mathtools} \usepackage{booktabs,array} \usepackage{xcolor} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \usepackage[colorlinks=true,linkcolor=blue!50!black,citecolor=blue!50!black,urlcolor=blue!50!black]{hyperref} \newtheorem{proposition}{Proposition}[section] \theoremstyle{definition} \newtheorem{definition}[proposition]{Definition} \theoremstyle{remark} \newtheorem{remark}[proposition]{Remark} \newcommand{\RI}{R_{\mathrm{I}}} \newcommand{\RII}{R_{\mathrm{II}}} \newcommand{\GK}{\mathcal{F}} \newcommand{\eps}{\varepsilon} \newcommand{\lemn}{\varpi} \newcommand{\doi}[1]{\href{https://doi.org/#1}{\nolinkurl{doi:#1}}} \definecolor{cDouble}{HTML}{2A78D6} \definecolor{cTriple}{HTML}{EB6834} \definecolor{cQuad}{HTML}{1BAF7A} \definecolor{cAlt}{HTML}{6250D6} \pgfplotsset{ errplot/.style={width=\textwidth,height=7.4cm,xmin=0,xmax=1, xlabel={$h=\bigl((a-b)/(a+b)\bigr)^2$},ylabel={$|\eps|$}, grid=major,grid style={gray!18},axis x line*=bottom, tick label style={font=\footnotesize},label style={font=\small}, legend style={font=\footnotesize,at={(0.5,-0.2)},anchor=north,legend columns=3,draw=none,/tikz/every even column/.append style={column sep=7pt}}, legend cell align=left}, ecc axis/.style={width=\textwidth,height=7.4cm,xmin=0,xmax=1,axis x line*=top,axis y line=none, xtick={0.0625,0.1543,0.2747,0.5666,0.8361,0.9450},xticklabels={0.8,0.9,0.95,0.99,0.999,0.9999}, xlabel={eccentricity $e$},tick label style={font=\footnotesize},label style={font=\small}}, sRI/.style={gray,densely dotted,line width=0.9pt}, sRII/.style={black,dashed,line width=0.9pt}, sD/.style={cDouble,line width=0.9pt}, sT/.style={cTriple,line width=0.9pt}, sTb/.style={cAlt,dash dot,line width=0.9pt}, sQ/.style={cQuad,line width=0.9pt}, sI3/.style={cAlt,densely dotted,line width=1.2pt}, } \begin{document} \title{Improved approximations for the perimeter of an ellipse} \author{Mika Inki} \date{November 2026} \subjclass[2020]{Primary 33E05; Secondary 41A50, 65D20, 51M25} \keywords{Perimeter of an ellipse, complete elliptic integrals, arithmetic--geometric mean, Legendre's relation, Ramanujan's approximations, Gauss--Kummer series, nested radicals, minimax approximation} \begin{abstract} We give three closed formulas, with three, four and six square roots, for the perimeter $P$ of an ellipse with semi-axes $a\ge b\ge0$. In exact arithmetic their maximum relative errors over all eccentricities, $4.0\times10^{-8}$, $4.1\times10^{-17}$ and $8.1\times10^{-37}$, lie below the unit roundoff of single, double and quadruple precision, respectively, and evaluated in that precision they are accurate to within about six units of it (for quadruple precision, as estimated with $34$-digit decimal arithmetic). Each formula writes a fixed number of steps of the arithmetic--geometric mean (AGM) as one expression, in a form that avoids the harmful cancellation. For flat ellipses, where any fixed number of AGM steps eventually fails (as $b\to0$ it tends to $2\pi a$ instead of $4a$), it switches to an approximation based on Legendre's relation, which expresses the complete elliptic integral $E$ of the second kind exactly through the integral $K$ of the first kind and two power series in $b/a$: the AGM steps supply an estimate of $K$, and the series are truncated to short polynomials. A final term makes the formula continuous at the switch, and we give the range of its coefficient that suffices for each precision. We prove that for every switch point and every accuracy there are such continuous formulas, and that the error of the continuous formula is at most that of the AGM branch plus twice that of the flat-ellipse branch. The formulas are exact at $b=0$ and at $b=a$; numerically, they are increasing in $b$ and more accurate than Ramanujan's second approximation at every eccentricity, by factors of at least $289$, $2.8\times10^{11}$ and $4.1\times10^{32}$. With the latency of three, four or six AGM steps, they are faster than an AGM loop of the same accuracy for flat ellipses, where the loop needs more steps. We also study nested-radical generalisations $P\approx\pi(a+b)(1+3h/D)$ of Ramanujan's second approximation, with $h=((a-b)/(a+b))^2$ and $D$ a constant plus nested square roots of a polynomial in $h$. Ramanujan's formula is a degenerate member of a one-parameter family of double-nested forms that agree with the Gauss--Kummer series through $h^4$. We derive double- and triple-nested formulas with integer coefficients and double-, triple- and quadruple-nested formulas with real coefficients: formulas that are, as verified numerically, nowhere less accurate than Ramanujan's, formulas that agree with the series to the highest order possible for their depth, and minimax formulas. The best of them reduce the maximum error of Ramanujan's formula by up to five orders of magnitude. We also give a numerically stable evaluation in powers of $1-h$, tabulate the errors of all formulas at seven eccentricities where the perimeter has a closed form, and compare their cost with that of the AGM in double and single precision. \end{abstract} \maketitle \section{Introduction} The perimeter of an ellipse with semi-axes $a\ge b\ge0$ and eccentricity $e=\sqrt{1-b^2/a^2}$ is \begin{equation}\label{eq:P} P = 4a\int_0^{\pi/2}\sqrt{1-e^2\sin^2\theta}\,d\theta = 4a\,E(e), \end{equation} where $E$ is the complete elliptic integral of the second kind. Unlike the area $\pi ab$, the perimeter has no expression in terms of elementary functions, and the search for simple and accurate approximations has a long history; see the reviews by S\'ykora~\cite{Sykora,Sykora2007} and the survey of Almkvist and Berndt~\cite{AlmkvistBerndt}. The best-known approximations are the two given by Ramanujan in 1914~\cite{Ramanujan1914}, \begin{align} \RI &= \pi\Bigl(3(a+b)-\sqrt{(3a+b)(a+3b)}\Bigr), \label{eq:R1}\\ \RII &= \pi(a+b)\Bigl(1+\frac{3h}{10+\sqrt{4-3h}}\Bigr),\qquad h=\Bigl(\frac{a-b}{a+b}\Bigr)^{2}. \label{eq:R2} \end{align} The second one is remarkably accurate: its relative error is $O(h^5)$ as $h\to0$, and its largest value, about $4.0\times10^{-4}$, occurs for the degenerate ellipse $b=0$; see Villarino~\cite{Villarino} and Barnard, Pearce and Schovanec~\cite{BPS} for sharp error bounds of this type. The question of why the perimeter has no simple formula, and how good the known approximations are, has also reached a wide audience through popular presentations, for instance the Stand-up Maths video \emph{Why is there no equation for the perimeter of an ellipse\textinterrobang}~\cite{StandupMaths}. For $b>0$ the perimeter can also be computed to any accuracy with the arithmetic--geometric mean (AGM)~\cite{BorweinBorwein,Salamin}. The AGM eventually converges quadratically, but it is an iteration: the number of steps needed grows without bound as the ellipse becomes flatter, and every truncation of it fails completely as $b\to0$. Recent work has refined Ramanujan's second approximation by symbolic regression~\cite{MoscatoCiezak}, by an exponential correction factor~\cite{AyalaRaggi2025} and by a correction of its radicand~\cite{Shankar}, and has proposed other closed forms that combine rational functions with logarithms~\cite{ELIP}; the most accurate of these closed formulas, the ELIP family of Ayala-Raggi and Rend\'on-Mar\'in~\cite{ELIP}, reaches a certified maximum relative error of $4.5\times10^{-10}$. For numerical libraries, Hastings~\cite{Hastings} and Cody~\cite{Cody1965} gave approximations of $E$ of the form $p_1(\eta)+p_2(\eta)\ln(1/\eta)$ with polynomials $p_1$ and $p_2$ in $\eta=(b/a)^2$, the latter with maximum errors down to $3.8\times10^{-18}$, and Fukushima~\cite{Fukushima2009,Fukushima2011,Fukushima2015} developed piecewise polynomial and rational approximations accurate to within a few machine epsilons in single and double precision. These approximations need a logarithm and coefficients computed separately for each precision, and the piecewise ones are continuous only to within their approximation error. \enlargethispage{2pt} Our main results (Section~\ref{sec:main}) are three closed formulas built from a fixed number of AGM steps, written as one expression in a form that avoids the harmful cancellation. For flat ellipses, where any fixed number of AGM steps eventually fails, they switch to an approximation based on Legendre's relation, which expresses $E$ exactly through the complete elliptic integral $K$ of the first kind and two power series in $t=b/a$; the series are truncated, and $K$ is estimated from the same AGM steps. A single extra term makes the two branches agree at the switch. In exact arithmetic, the resulting formulas have maximum relative errors below the unit roundoff of single, double and quadruple precision: \begin{itemize} \item $A_3$ (three square roots): maximum relative error $4.0\times10^{-8}$, below $2^{-24}\approx6.0\times10^{-8}$; \item $A_4$ (four square roots): maximum relative error $4.1\times10^{-17}$, below $2^{-53}\approx1.1\times10^{-16}$; \item $A_6$ (six square roots): maximum relative error $8.1\times10^{-37}$, below $2^{-113}\approx9.6\times10^{-35}$, \end{itemize} in each case for all eccentricities $0\le e\le1$, including the degenerate ellipse $b=0$, where they give exactly $4a$. Evaluated in binary32 and binary64, $A_3$ and $A_4$ are accurate to within about six units of the unit roundoff, and emulated $34$-digit decimal arithmetic suggests that $A_6$ is accurate to within a few units in binary128. The formulas are continuous, contain no loops, and use a single comparison to choose between two branches of almost equal latency; numerically, they are increasing in $b$ and more accurate than Ramanujan's second approximation at every eccentricity, by factors of at least $289$, $2.8\times10^{11}$ and $4.1\times10^{32}$. In double precision, $A_4$ has about the latency of four AGM steps, whereas an AGM loop iterated to the same accuracy needs, in exact arithmetic, more steps for $b/a<0.09$ (and fewer for $b/a>0.55$), and ever more as $b\to0$; in binary64 the loop moreover loses accuracy for flat ellipses (Section~\ref{sec:double}). The continuity coefficient may vary in a wide interval without the error or the jump at the switch exceeding the unit roundoff, and for $A_4$ and $A_6$ it may even be omitted, at the price of a jump below the unit roundoff (Table~\ref{tab:agmforms}). Unlike the recent closed formulas cited above, whose maximum errors are at least $4.5\times10^{-10}$, $A_4$ and $A_6$ are accurate to double and quadruple precision, and unlike the library approximations, all three formulas need no logarithm: they use only arithmetic operations and square roots, which IEEE~754 requires to be correctly rounded~\cite{IEEE754}, use a single small set of exact coefficients for all shapes and contain no fitted parameters, and the same construction gives a continuous formula for any precision (Proposition~\ref{prop:conv}). The second part of the note (Sections~\ref{sec:nested}--\ref{sec:minimax}) keeps the structure of Ramanujan's second approximation~\eqref{eq:R2} and replaces its square root $\sqrt{4-3h}$ by nested square roots of polynomials in~$h$, a form that, to our knowledge, has not been considered before. The resulting short, branch-free formulas reduce the maximum error of $\RII$ by up to five orders of magnitude. The analysis also clarifies Ramanujan's formula: $\RII$ is the degenerate member, with a perfect-square inner radicand, of a one-parameter family of double-nested forms that all agree with the Gauss--Kummer series through $h^4$, and its accuracy near the circle comes from two vanishing coefficients in an ideal radicand (Section~\ref{sec:prelim}). We consider four families, with double-, triple- and, except for the integer formulas, quadruple-nested members: \begin{enumerate} \item integer-coefficient formulas that are, as verified numerically, nowhere less accurate than $\RII$ (Section~\ref{sec:int}), \item real-coefficient formulas with the same property, numerically optimised for the smallest maximum error (Section~\ref{sec:dom}), \item formulas that agree with the Gauss--Kummer series to the highest order possible for their depth (Section~\ref{sec:match}), \item minimax formulas, numerically optimised for the smallest maximum error without further constraints (Section~\ref{sec:minimax}). \end{enumerate} Section~\ref{sec:prelim} collects background, Sections~\ref{sec:main}--\ref{sec:agmacc} state, derive and analyse the main formulas, and Section~\ref{sec:tform} gives a numerically stable evaluation of the nested-radical formulas. Section~\ref{sec:points} lists seven eccentricities with closed-form perimeters and the errors of all formulas there, and Sections~\ref{sec:summary} and~\ref{sec:cost} summarise the accuracy and the cost of all formulas and explain how the cost was estimated, in double and in single precision. All results in this note were derived with the assistance of the large language model Claude Opus~5.5 (Anthropic), which carried out the derivations and the searches, numerical optimisation and high-precision verification described in Section~\ref{sec:numerics}; see also the provenance statement at the end. \section{Preliminaries}\label{sec:prelim} \subsection{The Gauss--Kummer series} Write $\lambda=(a-b)/(a+b)$ and $h=\lambda^2$. Parametrising the ellipse as $z(\theta)=a\cos\theta+\mathrm{i}\,b\sin\theta=\tfrac{a+b}{2}e^{\mathrm{i}\theta}+\tfrac{a-b}{2}e^{-\mathrm{i}\theta}$ gives $|z'(\theta)|=\tfrac{a+b}{2}\,|1-\lambda e^{-2\mathrm{i}\theta}|$, hence \[ P=\frac{a+b}{2}\int_0^{2\pi}(1-\lambda e^{-2\mathrm{i}\theta})^{1/2}(1-\lambda e^{2\mathrm{i}\theta})^{1/2}\,d\theta . \] Expanding both factors by the binomial theorem and integrating term by term, only the diagonal terms survive, and \begin{equation}\label{eq:GK} \begin{aligned} P&=\pi(a+b)\,\GK(h),\qquad \GK(h)=\sum_{n=0}^{\infty}\binom{1/2}{n}^{2}h^{n}={}_2F_1\!\left(-\tfrac12,-\tfrac12;1;h\right),\\ \GK(h)&=1+\frac{h}{4}+\frac{h^2}{64}+\frac{h^3}{256}+\frac{25h^4}{16384}+\frac{49h^5}{65536}+\cdots . \end{aligned} \end{equation} This series is due to Ivory~\cite{Ivory1798} and, in hypergeometric form, to Gauss and Kummer~\cite{Kummer1836}; see~\cite{AlmkvistBerndt} for the history. It converges for $0\le h\le1$, but slowly near $h=1$, where $\GK(1)=4/\pi$ and $\GK$ has a logarithmic singularity of the form $(1-h)^2\log(1-h)$. \subsection{Normalisation} Since $P/(\pi(a+b))$ depends only on the shape of the ellipse, every approximation in this note can be written in the form $P\approx\pi(a+b)R(h)$ (for the main formulas of Section~\ref{sec:main}, which use $t=b/a$, this is only a change of variables), and we measure it by the relative error \[ \eps(h)=\frac{R(h)}{\GK(h)}-1 , \] which depends on the shape of the ellipse only. The variable $h$ runs from $0$ (circle) to $1$ (the degenerate ellipse $b=0$); for orientation, $e=0.9$, $0.99$ and $0.999$ correspond to $h\approx0.154$, $0.567$ and $0.836$. Since $\GK(h)=1+h/4+O(h^2)$, it is convenient to write \begin{equation}\label{eq:G} \GK(h)=1+\frac{3h}{12\,G(h)},\qquad 12\,G(h)=\frac{3h}{\GK(h)-1}=12-\frac{3h}{4}-\frac{9h^2}{64}-\frac{27h^3}{512}-\frac{423h^4}{16384}-\cdots, \end{equation} so that an approximation $R(h)=1+3h/D(h)$ is exact precisely when $D=12G$. \subsection{Ramanujan's approximations} In this notation $\RI$ corresponds to $R(h)=3-\sqrt{4-h}$ and $\RII$ to $D(h)=10+\sqrt{4-3h}$. Expanding, \[ \eps_{\mathrm{I}}(h)=-\frac{h^{3}}{512}+O(h^{4}),\qquad \eps_{\mathrm{II}}(h)=-\frac{3h^{5}}{131072}+O(h^{6}). \] The high order of agreement of $\RII$ with the series has a simple explanation. The function that would make $D$ exact is $D=10+\sqrt{T(h)}$ with \begin{equation}\label{eq:T} T(h)=\bigl(12G(h)-10\bigr)^2=4-3h+0\cdot h^{2}+0\cdot h^{3}-\frac{9}{2048}h^{4}+O(h^{5}), \end{equation} and the coefficients of $h^2$ and $h^3$ happen to vanish. Ramanujan's $\sqrt{4-3h}$ is therefore the square root of the first two terms of a series that is correct through $h^3$, and the first error comes from the neglected $h^4$ term of $T$. Shankar~\cite{Shankar}, who obtains $\RI$ and $\RII$ from a continued-fraction expansion of the series (Viscovatov's algorithm; see~\cite{BakerGravesMorris}), proposes the radicand $4-3h-\tfrac{9}{2048}h^4$, that is,~\eqref{eq:T} truncated after~$h^4$. \subsection{The arithmetic--geometric mean} For $b>0$ the perimeter can be computed to any precision with the Gauss--Legendre form of the AGM~\cite{BorweinBorwein,Salamin}: with $a_0=a$, $b_0=b$, $c_0^2=a^2-b^2$ and \[ a_{j+1}=\tfrac12(a_j+b_j),\qquad b_{j+1}=\sqrt{a_jb_j},\qquad c_{j+1}=\tfrac12(a_j-b_j), \] one has \begin{equation}\label{eq:AGM} P=\frac{2\pi}{M}\Bigl(a^2-\sum_{j\ge0}2^{\,j-1}c_j^{2}\Bigr),\qquad M=\lim_{j\to\infty}a_j=\lim_{j\to\infty}b_j . \end{equation} Truncating after $N$ steps and replacing $M$ by $(a_N+b_N)/2$ gives an error that decreases quadratically once $a_j/b_j$ is close to $1$, each step roughly squaring it. For flat ellipses this phase begins only after about $\log_2\ln(4a/b)$ steps, so the number of steps needed grows, slowly but without bound, as $b\to0$; to reach the double-precision unit roundoff in exact arithmetic, $N=4$ steps suffice for $e\le0.995$ and $N=7$ for $b/a\ge10^{-6}$ (Section~\ref{sec:double}). At $b=0$ one has $M=0$, the formula~\eqref{eq:AGM} breaks down, and every truncation gives $2\pi a$ instead of $4a$ (Section~\ref{sec:trunc}). Each step costs one square root. The AGM is the basis of the main formulas of Section~\ref{sec:main}. It is also the reference method of this note, and its cost at matching accuracy is the yardstick for the cost of the closed-form approximations (Section~\ref{sec:cost}). \section{Main results}\label{sec:main} Our main results are three closed formulas, $A_3$, $A_4$ and $A_6$, for single, double and quadruple precision. Each is built from a fixed number $N$ of steps of the AGM, written as one expression, and has two branches. For $b\ge t_sa$ it is the truncated AGM in a form that avoids the harmful cancellation. For flat ellipses, $b0$, let $t=b/a$, and let \begin{gather*} b_1=\sqrt{ab},\qquad a_1=\frac{a+b}{2},\qquad c_1=\frac{a-b}{2},\\ a_{j+1}=\frac{a_j+b_j}{2},\qquad b_{j+1}=\sqrt{a_jb_j}\qquad(j=1,\dots,N-1). \end{gather*} Let $\mathcal P_n$ and $\mathcal Q_n$ be the polynomials obtained by truncating the series \begin{equation}\label{eq:PQ} \begin{aligned} \mathcal P(t)&=\tfrac12t^2+\tfrac1{16}t^4+\tfrac1{32}t^6+\tfrac{41}{2048}t^8+\tfrac{59}{4096}t^{10}+\tfrac{727}{65536}t^{12}+\tfrac{1171}{131072}t^{14}+\cdots,\\ \mathcal Q(t)&=1-\tfrac14t^2-\tfrac5{64}t^4-\tfrac{11}{256}t^6-\tfrac{469}{16384}t^8-\tfrac{1379}{65536}t^{10}-\tfrac{17223}{1048576}t^{12}-\tfrac{56001}{4194304}t^{14}-\cdots \end{aligned} \end{equation} after the term in $t^{2n}$. The series are the expansions of $1-E(t)/K(t)$ and $\pi/(2K(t))$ in powers of $t$, where $E(t)$ and $K(t)$ are the complete elliptic integrals with modulus $t$ (Section~\ref{sec:legendre}). In the formulas below, $K$ without an argument denotes an estimate of $K(e)$ computed from the AGM steps. The single-precision formula, with three square roots, is \begin{equation}\label{eq:A3} A_3:\qquad P\approx\begin{cases}\dfrac{4\pi}{a_3+b_3}\Bigl[a_2^2+\dfrac{b_1c_1^2}{b_2+b_1}\Bigr], & b\ge0.1\,a,\\[10pt] 4a\Bigl[1+\dfrac{t^2}{2}\Bigl(K-\dfrac12\Bigr)+\dfrac{t^4}{16}\Bigl(K-\dfrac54\Bigr)+\gamma\,t^6\Bigr],\quad K=\dfrac{\pi a}{a_3+b_3}, & b<0.1\,a,\end{cases} \end{equation} with $\gamma=0.1136228983147862$; the bracket on the second line is $K\mathcal P_2(t)+\mathcal Q_2(t)+\gamma\,t^6$. The double-precision formula, with four square roots, is \begin{equation}\label{eq:A4} A_4:\qquad P\approx\begin{cases}\dfrac{4\pi}{a_4+b_4}\Bigl[a_2^2+\dfrac{b_1c_1^2}{b_2+b_1}-2(a_3-b_3)^2\Bigr], & b\ge0.1\,a,\\[10pt] 4a\Bigl[K\,\mathcal P_7(t)+\mathcal Q_7(t)+\gamma\,t^{16}\Bigr],\quad K=\dfrac{4\pi a\,(a_4+b_4)}{3a_4^2+10a_4b_4+3b_4^2}, & b<0.1\,a,\end{cases} \end{equation} with $\gamma=0.4317358822607176$. For the quadruple-precision formula, with six square roots, let \[ N_6=a_2^2+\frac{b_1c_1^2}{b_2+b_1}-2(a_3-b_3)^2-4(a_4-b_4)^2-8(a_5-b_5)^2 ; \] then \begin{equation}\label{eq:A6} A_6:\qquad P\approx\begin{cases}\dfrac{4\pi N_6}{a_6+b_6}, & b\ge0.0033\,a,\\[10pt] 4a\Bigl[K\,\mathcal P_6(t)+\mathcal Q_6(t)+\gamma\,t^{14}\Bigr],\quad K=\dfrac{4\pi a\,(a_6+b_6)}{3a_6^2+10a_6b_6+3b_6^2}, & b<0.0033\,a,\end{cases} \end{equation} with $\gamma=0.09481603685489218$. In all three, $\mathcal P_n$ and $\mathcal Q_n$ are best evaluated by Horner's rule in $t^2$. \begin{table}[htbp] \centering \scriptsize \setlength{\tabcolsep}{2.4pt} \caption{The main formulas~\eqref{eq:A3}--\eqref{eq:A6}. $N$: AGM steps (square roots); $n$: degree of $\mathcal P_n$ and $\mathcal Q_n$ in $t^2$; $K$: estimate of $K(e)$, either $\pi a/(a_N+b_N)$ (simple) or the refined estimate~\eqref{eq:Kref}; $t_s$: switch point $b/a$; $\gamma$: continuity coefficient~\eqref{eq:cont}; sufficient $\gamma$: interval for which both the maximum error in exact arithmetic and the jump at the switch stay within the unit roundoff $u$ of the target format; error: maximum relative error over $0\le b\le a$, in exact arithmetic and in the target arithmetic (on about $5000$ shapes; a denser sample gives $3.6\mathrm{e}{-7}$ for $A_3$ and $7.1\mathrm{e}{-16}$ for $A_4$; for $A_6$, $34$-digit decimal arithmetic; see Section~\ref{sec:agmacc}); gain: minimum of $|\eps_{\mathrm{II}}|/|\eps|$ over $00.07$, lie below the plotted range. The dashed, dotted and dash-dotted grey lines mark the unit roundoff of binary32, binary64 and binary128. Each of $A_3$, $A_4$, $A_6$ is continuous and attains its maximum error at its switch point, $b/a=0.1$, $0.1$ and $0.0033$; all three give exactly $4a$ at $b=0$. The sharp downward spikes below the switch points, at $b/a\approx0.050$, $0.020$ and $1.0\times10^{-4}$, are the sign changes of their errors, which are positive for larger and negative for smaller $b/a$; the sampling is refined there. The three dips of $I_3$, at $b/a\approx0.63$, $0.014$ and $9.1\times10^{-4}$, are sign changes of its own error. For $b\ge0.0033a$, $A_6$ coincides with $P_6$, whose error grows without the correction to $1.5\times10^{-16}$ at $b/a=10^{-6}$ and to $0.57$ at $b=0$. For $b/a\le10^{-6}$ the errors of $\RII$ and $I_3$ are close to their values for the degenerate ellipse.} \label{fig:agm6} \end{figure} Table~\ref{tab:agmforms} summarises the properties of the three formulas. All three are continuous, and in exact arithmetic they are increasing in $b$, as is the exact perimeter (checked numerically for $10^{-12}\le b/a\le1$). They give exactly $4a$ at $b=0$, and $2\pi a$ at $b=a$. Their maximum relative errors in exact arithmetic, $4.0\times10^{-8}$, $4.1\times10^{-17}$ and $8.1\times10^{-37}$, lie below the unit roundoff $u$ of binary32, binary64 and binary128, respectively. These maxima are attained at the switch points, and the formulas are much more accurate away from them (Figure~\ref{fig:agm6}). Numerically, at every eccentricity they are more accurate than Ramanujan's second approximation, by factors of at least $289$, $2.8\times10^{11}$ and $4.1\times10^{32}$. In the target arithmetic, rounding dominates, and the errors are up to about six units of $u$ (for $A_6$ as estimated with $34$-digit decimal arithmetic; Section~\ref{sec:agmacc}). Neither branch contains a loop, and the two branches have almost the same latency, although the flat branch needs more multiply--adds. In the latency model of Section~\ref{sec:cost} the formulas take about $81$, $101$ and $141$ cycles in double precision, compared with $62$ cycles for $\RII$, $110$ for the triple-nested formula $I_3$ of Section~\ref{sec:int}, and $161$ for seven AGM steps, the fixed number needed, in exact arithmetic, to reach double precision for all $b/a\ge10^{-6}$. Section~\ref{sec:agmacc} also compares them with an AGM loop that stops as soon as it is accurate. The continuity coefficient $\gamma$ need not be stored to many digits. For a target format with unit roundoff $u$ we call $\gamma$ \emph{sufficient} if the maximum relative error in exact arithmetic is at most $u$ and the jump at the switch is at most $u$. The sufficient values form an interval (Section~\ref{sec:continuity}), and these intervals are wide. For $A_3$ the jump without the continuity term would be $1.1\times10^{-7}$, about $1.9u$ in binary32. Here the term is necessary, but any $\gamma\in[0.0531,0.1336]$ will do, for instance $\gamma=0.1$. For $A_4$ and $A_6$ the jumps without it, $4.2\times10^{-17}$ ($0.38u$ in binary64) and $1.7\times10^{-36}$ ($0.018u$ in binary128), are already below the unit roundoff. There $\gamma=0$ is sufficient, and the term only removes the jump. Any $\gamma\in[-0.696,1.146]$ for $A_4$, and any $\gamma\in[-5.207,5.359]$ for $A_6$, keeps both the maximum error and the jump within $u$. With $\gamma$ rounded to the digits printed in~\eqref{eq:A3}--\eqref{eq:A6}, the remaining jumps are below $10^{-22}$, $10^{-32}$ and $10^{-52}$ relative to $P$. \section{Derivation of the main formulas}\label{sec:derivation} The AGM~\eqref{eq:AGM} truncated after a fixed number $N$ of steps is itself a closed formula. It has $N$ square roots, nested $N$ deep, and no branches. Writing several steps as one makes this explicit (Section~\ref{sec:steps}). Every truncated AGM fails as $b\to0$ (Section~\ref{sec:trunc}). An approximation based on Legendre's relation, which rewrites $E$ exactly, repairs this (Section~\ref{sec:legendre}), and one further term makes the result continuous (Section~\ref{sec:continuity}). \subsection{Several steps at once}\label{sec:steps} Let $x=\sqrt a$, $y=\sqrt b$, and let \[ \mu_1=\frac{x+y}{2},\qquad \mu_0=\sqrt{xy},\qquad \mu_2=\sqrt{\frac{x^2+y^2}{2}} \] be the arithmetic, geometric and quadratic means of $x$ and $y$. Two steps of the AGM give \[ a_2=\mu_1^2,\qquad b_2=\mu_2\mu_0,\qquad c_2=\Bigl(\frac{x-y}{2}\Bigr)^2 , \] and the moduli $\lambda_j=c_j/a_j$ after one and two steps are \[ \lambda_1=\frac{a-b}{a+b}=\lambda,\qquad \sqrt{\lambda_2}=\frac{\sqrt a-\sqrt b}{\sqrt a+\sqrt b}=\frac{1-\sqrt t}{1+\sqrt t} . \] Thus the variable $h=\lambda^2$ of the Gauss--Kummer series is the squared modulus after one AGM step, and two steps form the Borweins' quartic iteration~\cite{BorweinBorwein}. Three steps give the closed form \[ P_3=\frac{4\pi\mu_1^2\,\bigl(\mu_2^2+4\mu_2\mu_0-3\mu_0^2\bigr)}{\bigl(\mu_1+\sqrt{\mu_2\mu_0}\bigr)^2}, \] whose relative error is $3\times10^{-16}$ at $e=0.85$, $1.7\times10^{-14}$ at $e=0.9$ and $4.0\times10^{-8}$ at $e=0.995$. In general, for $N\ge3$, \begin{equation}\label{eq:PN} P_N=\frac{4\pi\Bigl[a_2\,(a_2+2b_2-2b_1)-\sum_{j=4}^{N}2^{\,j-3}\,(a_{j-1}-b_{j-1})^2\Bigr]}{\tfrac12(a_{N-1}+b_{N-1})+\sqrt{a_{N-1}b_{N-1}}} , \end{equation} where the denominator equals $a_N+b_N=\tfrac12\bigl(\sqrt{a_{N-1}}+\sqrt{b_{N-1}}\bigr)^2$. Combining steps does not save square roots: after $N$ steps the quantities generically lie in a tower of $N$ successive quadratic extensions of $\mathbb{Q}(a,b)$, and we know of no expression for $P_N$ with fewer than $N$ square roots. In floating point the first term of the numerator suffers from cancellation, because $b_2$ and $b_1$ are close unless $b\ll a$. Since $a_1-b_1=c_1^2/(2a_2)$ with $c_1=(a-b)/2$, and $b_2-b_1=b_1(a_1-b_1)/(b_2+b_1)$, it can be rewritten exactly as \begin{equation}\label{eq:num} a_2\,(a_2+2b_2-2b_1)=a_2^2+\frac{b_1c_1^2}{b_2+b_1}, \end{equation} in which all terms are positive. The remaining terms $2^{\,j-3}(a_{j-1}-b_{j-1})^2$ are small for the shapes on which the main formulas use~\eqref{eq:PNnum} ($b\ge t_sa$), so their cancellation is harmless there. For very flat ellipses these terms become comparable to the first two, and cancellation again amplifies rounding errors (Section~\ref{sec:double}). \subsection{Truncation and flat ellipses}\label{sec:trunc} With the quantities of Section~\ref{sec:main} and~\eqref{eq:num}, the truncated AGM~\eqref{eq:PN} becomes \begin{equation}\label{eq:PNnum} P_N=\frac{4\pi}{a_N+b_N}\Bigl[a_2^2+\frac{b_1c_1^2}{b_2+b_1}-\sum_{j=4}^{N}2^{\,j-3}(a_{j-1}-b_{j-1})^2\Bigr]. \end{equation} This is the first branch of each of~\eqref{eq:A3}--\eqref{eq:A6}. For moderate eccentricities its error is tiny and falls very fast as $N$ grows. For $N=6$, for example, it is below $10^{-50}$ for $e\le0.995$, $2.5\times10^{-31}$ at $b/a=10^{-3}$ and $1.5\times10^{-16}$ at $b/a=10^{-6}$. Every truncated AGM fails as $b\to0$, however: it tends to $2\pi a$ instead of $4a$, a relative error of $57\%$, because for $b=0$ the sum $\sum_{j\le N}2^{j-1}c_j^2$ equals $a^2(1-2^{-N-1})$, while $a_N+b_N=2^{-N}a$. For flat ellipses, $P_N$ is therefore replaced by a truncated expansion in $t=b/a$. \subsection{A correction for flat ellipses from Legendre's relation}\label{sec:legendre} Legendre's relation $EK'+E'K-KK'=\pi/2$~\cite[\S19.7]{DLMF}, with $K'=K(k')$, $E'=E(k')$ and $k'=t=b/a$, can be solved for $E$: \begin{equation}\label{eq:legendre} E(k)=K(k)\,\mathcal P(t)+\mathcal Q(t),\qquad \mathcal P(t)=1-\frac{E(t)}{K(t)},\qquad \mathcal Q(t)=\frac{\pi}{2K(t)} . \end{equation} This identity is exact. For $|t|<1$, the integrals $K(t)$ and $E(t)$ are $\pi/2$ times power series in $t^2$ with rational coefficients, so $\mathcal P$ and $\mathcal Q$ are power series in $t^2$ with rational coefficients, in fact dyadic rationals, because those of $2K(t)/\pi$ are and $E(t)/K(t)=1-t^2+t(1-t^2)\,(dK/dt)/K(t)$; their first terms are given in~\eqref{eq:PQ}, and $\mathcal P_n$, $\mathcal Q_n$ denote the truncations after $t^{2n}$. The large quantity $K=K(k)$, which grows like $\ln(4a/b)$, must still be estimated, and the AGM provides it through $K=\pi a/(2M(a,b))$. The simplest estimate is $K\approx\pi a/(a_N+b_N)$. A better one follows from expanding one more AGM step without its square root, $M=\tfrac12(a_N+b_N)-(a_N-b_N)^2/\bigl(8(a_N+b_N)\bigr)+O\bigl((a_N-b_N)^4/a_N^3\bigr)$: \begin{equation}\label{eq:Kref} K\approx\frac{4\pi a\,(a_N+b_N)}{3a_N^2+10a_Nb_N+3b_N^2}. \end{equation} Errors in the estimate of $K$ are multiplied by $\mathcal P_n(t)\approx t^2/2$. As $b\to0$, where the truncated AGM itself is useless, the estimate is poor, with an error of order $\ln(4a/b)$, but its contribution is only of order $t^2\ln(4a/b)$ and tends to zero. At $b=0$ the corrected formula gives exactly $4a$, with no special case. Truncated after $t^4$ ($n=2$), \eqref{eq:legendre} becomes \begin{equation}\label{eq:EK} E\approx1+\frac{t^2}{2}\Bigl(K-\frac12\Bigr)+\frac{t^4}{16}\Bigl(K-\frac54\Bigr), \end{equation} which is the asymptotic expansion of $E$ for $k'\to0$ \cite[\S19.12]{DLMF} with the logarithm eliminated in favour of $K$; with the simple estimate of $K$, it is the flat branch of $A_3$ without the continuity term. Even the first term alone is useful. With $E\approx1+\tfrac{t^2}{2}(K-\tfrac12)$, the simple estimate of $K$, six steps and a switch at $b/a=10^{-5}$, the maximum error is $1.0\times10^{-19}$. With the plain fallback $P\approx4a$, the best switch is $b/a\approx7.7\times10^{-8}$, with error $5.1\times10^{-14}$. \subsection{Continuity at the switch}\label{sec:continuity} A formula of this type uses $P_N$ for $b\ge t_sa$ and $4a\bigl[K\mathcal P_n(t)+\mathcal Q_n(t)\bigr]$ for $b0$ there are $N_0$ and $n_0$ such that $|A_{N,n}/P-1|\le\varepsilon$ for $0\le b\le a$, $N\ge N_0$ and $n\ge n_0$. \end{enumerate} \end{proposition} The proof is given in Appendix~\ref{app:proof}. By part~(b), the error of the continuous formula is at most that of the AGM branch plus twice that of the Legendre branch; for the formulas of Table~\ref{tab:agmforms} it does not increase the maximum error at all, because the two branches err in opposite directions. The proposition also covers $t_s=1$, where the AGM is used only at $b=a$, so that the formula is essentially the Legendre expansion alone. That case rests on the absolute convergence of the series for $\mathcal P$ and $\mathcal Q$ up to $t=1$, which follows from a theorem of Kaluza~\cite{Kaluza}; the same theorem shows that no coefficient of $\mathcal Q$ after the first is positive (numerically, they are all negative). It is of no practical use, however. Even with the exact $K$, a relative error below $10^{-16}$ needs $21$ terms at $b/a=0.5$, $128$ at $b/a=0.9$ and $1209$ at $b/a=0.99$, and at $b=a$ the error after $n$ terms decreases only slightly faster than $1/n$, roughly like $1/(n\ln n)$, from $1.3\times10^{-3}$ at $n=10$ to $4.5\times10^{-6}$ at $n=1000$. Near the circle the expansion in $t=b/a$ converges slowly, much as the Gauss--Kummer series does near $b=0$, and the AGM, which converges fastest there, is its natural complement. With a switch at $t_s<1$ the series converge geometrically, like $t_s^{2n}$, and the AGM doubly exponentially, which is why a few steps and terms suffice. \section{Accuracy, rounding and cost of the main formulas}\label{sec:agmacc} Figure~\ref{fig:agm6} shows the errors in 90-digit arithmetic. Each formula attains its maximum at the switch point and is much more accurate away from it. Above the switch the error is that of the truncated AGM, which is positive. Just below it, the continuity term keeps the error positive. As $b$ decreases further, however, the negative error of the Legendre branch decays more slowly than the continuity term $\gamma t^{2n+2}$, because its truncation part contains the factor $K\sim\ln(4a/b)$ and the error of the estimate of $K$ is multiplied only by $\mathcal P_n(t)\approx t^2/2$. The error therefore changes sign, and numerically it does so exactly once, at $b/a=0.0504$, $0.0200$ and $1.01\times10^{-4}$ for $A_3$, $A_4$ and $A_6$, and is negative for all smaller $b>0$ (checked down to $b/a=10^{-40}$; as $b\to0$ the error of the estimate of $K$ dominates). The sign changes appear as the sharp downward spikes in Figure~\ref{fig:agm6}. Between the switch point and the sign change, the errors of $A_4$ and $A_6$ are close to constant multiples of $t^{2n+2}$ and therefore appear as nearly straight lines; the contribution of the estimate of $K$, which grows as $b$ decreases, becomes significant only very close to the sign change, so that the lines end abruptly in the spikes. $A_3$ stays below $1.0\times10^{-8}$ outside $0.0810$ if $|\delta|<\tfrac{9}{8192}$, and only if $|\delta|\le\tfrac{9}{8192}$. \end{proposition} \begin{proof} $R-\GK=3h\,(12G-D)/(12G\cdot D)=-3\delta h^5/144+O(h^6)$ and $\GK=1+O(h)$. For $\RII$ one has $D_4-12G_4=-\tfrac{405}{16384}+\tfrac{423}{16384}=\tfrac{9}{8192}$, which gives $\eps_{\mathrm{II}}=-\tfrac{3}{131072}h^5+O(h^6)$. \end{proof} A formula can be nowhere worse than $\RII$ only if it matches the series through $h^4$ and satisfies the condition of Proposition~\ref{prop:local}. Matching through $h^4$ leaves $m+d+1-4$ free parameters: one for double nesting, four for triple nesting and nine for quadruple nesting. \subsection{A one-parameter family containing Ramanujan's formula} For double nesting the free parameter can be taken to be $c=12-q$, and solving the matching conditions gives the family \begin{equation}\label{eq:family} D_c(h)=12-c+\sqrt{c^2-4c+c\sqrt{16-12h+\frac{9}{2c}\,h^2}}\,,\qquad c>0 . \end{equation} Its radicands stay nonnegative for all $0\le h\le1$ only when $c\ge1.2356$; the expansion at $h=0$ in Proposition~\ref{prop:family} exists for every $c>0$. \begin{proposition}\label{prop:family} For every $c>0$, $D_c=12G+\delta(c)h^4+O(h^5)$ with \[ \delta(c)=\frac{9}{8192}\cdot\frac{c^2+9c-18}{c^{2}},\qquad\text{so}\qquad \eps_c(h)=-\frac{3}{131072}\cdot\frac{c^2+9c-18}{c^{2}}\,h^{5}+O(h^{6}). \] \end{proposition} The expansion is a direct computation; we checked it in exact rational arithmetic for several rational values of $c$. It has several consequences. \begin{itemize} \item For $c=2$ the inner radicand is $(4-\tfrac32h)^2$, and $D_2=10+\sqrt{4-3h}$: \emph{Ramanujan's second approximation is the member $c=2$ of the family.} \item By Proposition~\ref{prop:local}, the members with $\tfrac320.996$ (one of $I_3$, one of $B_3$ and two of $B_4$) merge at the right edge, and that of $I_3$ at $h\approx0.051$ lies below the plotted range.} \label{fig:dom} \end{figure} \section{Maximal agreement with the Gauss--Kummer series}\label{sec:match} Using all parameters for series matching, as in Section~\ref{sec:nested}, gives formulas $S_2$, $S_3$, $S_4$ with $\eps=O(h^6)$, $O(h^9)$ and $O(h^{14})$. They play for this form the role that Pad\'e approximants play for rational functions~\cite{BakerGravesMorris}. For triple and quadruple nesting the matching equations have several real solutions; among those we found for which all radicands stay positive on $[0,1]$, we chose the one with the smallest maximum error. $S_2$ belongs to the family~\eqref{eq:family} with $c=\tfrac32(\sqrt{17}-3)$: \[ S_2:\qquad P\approx\pi(a+b)\left(1+\frac{3h}{\frac{33-3\sqrt{17}}{2}+\sqrt{c^2-4c+c\sqrt{16-12h+\frac{9}{2c}h^2}}}\right),\qquad c=\tfrac32\bigl(\sqrt{17}-3\bigr). \] The constants of $S_3$ and $S_4$ are given in Appendix~\ref{app:const}. These formulas are extremely accurate for small and moderate eccentricities: at $e=0.9$ their relative errors are $+1.5\times10^{-11}$, $-6.3\times10^{-15}$ and $+2.5\times10^{-22}$. The last value requires the constants of $S_4$ to more than the $16$ digits of Appendix~\ref{app:const}; with those, rounding of the constants limits the error at $e=0.9$ to about $10^{-18}$ (Section~\ref{sec:numerics}). However, their maximum errors, attained at $e=1$, are comparatively large: $1.42\times10^{-4}$, $6.14\times10^{-5}$ and $7.83\times10^{-6}$ (Figure~\ref{fig:match}). Numerically, all three are nevertheless nowhere less accurate than $\RII$, by at least the factors $2.83$, $6.55$ and $51.4$, which are attained at $e=1$. % Data thinned for typesetting speed: per curve, points within 0.05 pt of the plotted polyline are omitted. \pgfplotstableread{ h R2 0.0025 2.243e-18 0.0050 7.203e-17 0.0075 5.489e-16 0.0100 2.321e-15 0.0125 7.108e-15 0.0150 1.775e-14 0.0175 3.850e-14 0.0200 7.533e-14 0.0225 1.362e-13 0.0250 2.315e-13 0.0300 5.803e-13 0.0325 8.689e-13 0.0375 1.790e-12 0.0425 3.371e-12 0.0475 5.922e-12 0.0525 9.838e-12 0.0575 1.562e-11 0.0625 2.387e-11 0.0700 4.254e-11 0.0775 7.155e-11 0.0850 1.148e-10 0.0925 1.772e-10 0.1000 2.647e-10 0.1075 3.844e-10 0.1175 6.090e-10 0.1275 9.304e-10 0.1375 1.379e-09 0.1475 1.989e-09 0.1600 3.048e-09 0.1725 4.529e-09 0.1850 6.558e-09 0.1975 9.283e-09 0.2100 1.288e-08 0.2225 1.757e-08 0.2375 2.497e-08 0.2525 3.481e-08 0.2675 4.769e-08 0.3000 8.970e-08 0.3325 1.594e-07 0.3550 2.308e-07 0.3750 3.157e-07 0.4175 5.884e-07 0.4525 9.477e-07 0.4900 1.533e-06 0.5325 2.565e-06 0.5775 4.299e-06 0.6200 6.854e-06 0.6750 1.225e-05 0.851500000 7.313e-05 0.910000000 1.347e-04 0.940500000 1.886e-04 0.964500000 2.499e-04 0.984500000 3.221e-04 1.000000000 4.023e-04 }\matchtaba \pgfplotstableread{ h I3 0.0025 1.189e-20 0.0050 3.622e-19 0.0075 2.610e-18 0.0100 1.040e-17 0.0125 2.991e-17 0.0150 6.982e-17 0.0175 1.409e-16 0.0200 2.552e-16 0.0225 4.242e-16 0.0250 6.578e-16 0.0275 9.611e-16 0.0300 1.332e-15 0.0325 1.758e-15 0.0350 2.212e-15 0.0375 2.647e-15 0.0400 2.993e-15 0.0425 3.151e-15 0.0450 2.985e-15 0.0475 2.318e-15 0.0500 9.225e-16 0.050906978 1.826e-16 0.051105978 9.310e-19 0.051306978 1.899e-16 0.0525 1.486e-15 0.0550 5.260e-15 0.0575 1.082e-14 0.0600 1.869e-14 0.0625 2.946e-14 0.0650 4.385e-14 0.0700 8.696e-14 0.0750 1.563e-13 0.0800 2.628e-13 0.0850 4.202e-13 0.0900 6.461e-13 0.0975 1.162e-12 0.1050 1.975e-12 0.1125 3.209e-12 0.1200 5.024e-12 0.1275 7.622e-12 0.1375 1.275e-11 0.1475 2.049e-11 0.1575 3.183e-11 0.1675 4.803e-11 0.1800 7.758e-11 0.1925 1.212e-10 0.2025 1.695e-10 0.2175 2.721e-10 0.2300 3.938e-10 0.2425 5.589e-10 0.2575 8.314e-10 0.2725 1.210e-09 0.2900 1.828e-09 0.3050 2.556e-09 0.3250 3.901e-09 0.3425 5.537e-09 0.3625 8.096e-09 0.3825 1.161e-08 0.4025 1.637e-08 0.440968856 3.037e-08 0.4875 6.016e-08 0.5125 8.474e-08 0.5425 1.253e-07 0.5950 2.366e-07 0.6225 3.227e-07 0.6550 4.567e-07 0.6825 6.028e-07 0.7125 8.011e-07 0.7400 1.021e-06 0.7650 1.249e-06 0.7875 1.472e-06 0.810000000 1.697e-06 0.827500000 1.859e-06 0.844500000 1.987e-06 0.860000000 2.058e-06 0.874500000 2.062e-06 0.889000000 1.977e-06 0.900500000 1.823e-06 0.910500000 1.609e-06 0.914500000 1.499e-06 0.919000000 1.357e-06 0.922500000 1.232e-06 0.926000000 1.094e-06 0.929000000 9.650e-07 0.932000000 8.256e-07 0.934500000 7.013e-07 0.936500000 5.967e-07 0.938500000 4.872e-07 0.940000000 4.021e-07 0.941500000 3.144e-07 0.942500000 2.544e-07 0.944000000 1.624e-07 0.945000000 9.962e-08 0.946000000 3.578e-08 0.946453362 6.490e-09 0.946554362 6.496e-11 0.946653362 6.501e-09 0.947000000 2.912e-08 0.947500000 6.196e-08 0.948000000 9.505e-08 0.949000000 1.620e-07 0.950500000 2.642e-07 0.952000000 3.684e-07 0.954000000 5.101e-07 0.956000000 6.545e-07 0.959000000 8.747e-07 0.962500000 1.134e-06 0.966500000 1.424e-06 0.970500000 1.695e-06 0.975000000 1.951e-06 0.977000000 2.039e-06 0.979500000 2.115e-06 0.981500000 2.140e-06 0.983500000 2.127e-06 0.985000000 2.084e-06 0.986500000 2.007e-06 0.988000000 1.891e-06 0.989000000 1.787e-06 0.991000000 1.505e-06 0.992500000 1.212e-06 0.994000000 8.342e-07 0.995000000 5.240e-07 0.995500000 3.486e-07 0.996000000 1.581e-07 0.996335283 2.109e-08 0.996386283 4.237e-10 0.996485283 4.272e-08 0.997000000 2.745e-07 0.998000000 7.884e-07 0.999000000 1.406e-06 1.000000000 2.173e-06 }\matchtabb \pgfplotstableread{ h S2 0.0025 2.759e-22 0.0050 1.766e-20 0.0075 2.011e-19 0.0100 1.130e-18 0.0125 4.312e-18 0.0150 1.287e-17 0.0175 3.246e-17 0.0200 7.233e-17 0.0225 1.466e-16 0.0275 4.887e-16 0.0300 8.236e-16 0.0350 2.076e-15 0.0375 3.140e-15 0.0425 6.651e-15 0.0475 1.295e-14 0.0525 2.360e-14 0.0575 4.070e-14 0.0650 8.480e-14 0.0700 1.321e-13 0.0775 2.428e-13 0.0850 4.217e-13 0.0925 6.985e-13 0.1000 1.112e-12 0.1075 1.710e-12 0.1150 2.553e-12 0.1250 4.186e-12 0.1350 6.600e-12 0.1450 1.006e-11 0.1600 1.792e-11 0.1750 3.022e-11 0.1925 5.242e-11 0.2100 8.612e-11 0.2300 1.435e-10 0.2475 2.146e-10 0.2675 3.247e-10 0.2850 4.491e-10 0.3050 6.239e-10 0.3250 8.272e-10 0.3425 1.015e-09 0.3525 1.118e-09 0.3625 1.210e-09 0.3775 1.309e-09 0.3900 1.331e-09 0.3975 1.304e-09 0.4025 1.264e-09 0.4075 1.204e-09 0.4125 1.120e-09 0.4175 1.009e-09 0.4225 8.673e-10 0.4250 7.835e-10 0.4275 6.903e-10 0.4300 5.871e-10 0.4325 4.733e-10 0.4350 3.483e-10 0.4375 2.113e-10 0.4400 6.164e-11 0.440769856 1.288e-11 0.440970856 6.461e-14 0.441169856 1.297e-11 0.4425 1.015e-10 0.4450 2.788e-10 0.4475 4.712e-10 0.4500 6.796e-10 0.4525 9.049e-10 0.4550 1.148e-09 0.4575 1.410e-09 0.4625 1.995e-09 0.4700 3.041e-09 0.4775 4.321e-09 0.4850 5.874e-09 0.4975 9.192e-09 0.5100 1.364e-08 0.5225 1.951e-08 0.5375 2.898e-08 0.5550 4.439e-08 0.5750 6.985e-08 0.5975 1.126e-07 0.6200 1.767e-07 0.6400 2.592e-07 0.6675 4.298e-07 0.7200 1.074e-06 0.7675 2.369e-06 0.877000000 1.411e-05 0.930000000 3.473e-05 0.953500000 5.318e-05 0.973000000 7.759e-05 0.988500000 1.077e-04 1.000000000 1.424e-04 }\matchtabc \pgfplotstableread{ h S3 0.0025 1.000e-30 0.0050 1.485e-28 0.0075 5.754e-27 0.0100 7.725e-26 0.0125 5.802e-25 0.0150 3.018e-24 0.0175 1.218e-23 0.0200 4.086e-23 0.0225 1.189e-22 0.0275 7.355e-22 0.0325 3.363e-21 0.0375 1.239e-20 0.0425 3.886e-20 0.0450 6.554e-20 0.0500 1.720e-19 0.050906978 6.138e-19 0.051306978 6.321e-19 0.0525 2.691e-19 0.0575 6.205e-19 0.0625 1.336e-18 0.0675 2.717e-18 0.0725 5.256e-18 0.0775 9.744e-18 0.0850 2.296e-17 0.0900 3.906e-17 0.0975 8.238e-17 0.1050 1.647e-16 0.1125 3.146e-16 0.1200 5.774e-16 0.1275 1.023e-15 0.1350 1.758e-15 0.1450 3.466e-15 0.1525 5.606e-15 0.1625 1.030e-14 0.1725 1.828e-14 0.1850 3.594e-14 0.1950 5.991e-14 0.2075 1.099e-13 0.2200 1.951e-13 0.2350 3.743e-13 0.2500 6.927e-13 0.2650 1.242e-12 0.2800 2.166e-12 0.2950 3.684e-12 0.3125 6.654e-12 0.3300 1.170e-11 0.3475 2.009e-11 0.3675 3.629e-11 0.3850 5.965e-11 0.4050 1.031e-10 0.440968856 2.628e-10 0.4775 6.438e-10 0.5175 1.633e-09 0.5650 4.667e-09 0.6075 1.149e-08 0.6525 2.894e-08 0.835000000 1.108e-06 0.874000000 2.493e-06 0.905500000 4.942e-06 0.938500000 1.060e-05 0.963500000 1.993e-05 0.976000000 2.811e-05 0.985500000 3.727e-05 0.993500000 4.830e-05 1.000000000 6.142e-05 }\matchtabd \pgfplotstableread{ h S4 0.0025 1.000e-30 0.0400 1.000e-30 0.0425 1.993e-30 0.0450 4.495e-30 0.0500 2.017e-29 0.050906978 2.824e-19 0.051306978 2.847e-19 0.0525 4.046e-29 0.0600 2.729e-28 0.0675 1.477e-27 0.0725 4.123e-27 0.0775 1.077e-26 0.0825 2.654e-26 0.0875 6.213e-26 0.0975 2.983e-25 0.1025 6.172e-25 0.1100 1.728e-24 0.1150 3.308e-24 0.1225 8.346e-24 0.1350 3.484e-23 0.1425 7.743e-23 0.1500 1.656e-22 0.1575 3.418e-22 0.1650 6.839e-22 0.1800 2.518e-21 0.1900 5.684e-21 0.1975 1.020e-20 0.2050 1.796e-20 0.2150 3.708e-20 0.2250 7.431e-20 0.2350 1.449e-19 0.2450 2.757e-19 0.2550 5.124e-19 0.2650 9.328e-19 0.2775 1.919e-18 0.3000 6.567e-18 0.3125 1.257e-17 0.3250 2.356e-17 0.3500 7.802e-17 0.3750 2.412e-16 0.4025 7.796e-16 0.4300 2.369e-15 0.4625 8.222e-15 0.4950 2.675e-14 0.5300 8.951e-14 0.5675 3.064e-13 0.6050 9.875e-13 0.6275 1.939e-12 0.6475 3.468e-12 0.6825 9.175e-12 0.7025 1.551e-11 0.7150 2.121e-11 0.7300 3.028e-11 0.7425 3.989e-11 0.7550 5.114e-11 0.7650 6.069e-11 0.7750 6.946e-11 0.7800 7.288e-11 0.7850 7.511e-11 0.7900 7.554e-11 0.7925 7.484e-11 0.7975 7.100e-11 0.800000000 6.757e-11 0.802500000 6.290e-11 0.804500000 5.812e-11 0.806500000 5.230e-11 0.808000000 4.717e-11 0.809500000 4.132e-11 0.811000000 3.467e-11 0.812000000 2.976e-11 0.813500000 2.164e-11 0.814500000 1.567e-11 0.815500000 9.238e-12 0.816000000 5.837e-12 0.816500000 2.310e-12 0.816717767 7.326e-13 0.816816767 7.352e-15 0.817000000 1.349e-12 0.817500000 5.142e-12 0.818000000 9.073e-12 0.818500000 1.315e-11 0.819500000 2.174e-11 0.820500000 3.094e-11 0.822000000 4.599e-11 0.823500000 6.264e-11 0.825500000 8.755e-11 0.827500000 1.159e-10 0.830000000 1.568e-10 0.835000000 2.600e-10 0.841000000 4.321e-10 0.848000000 7.241e-10 0.856000000 1.232e-09 0.865000000 2.140e-09 0.877000000 4.273e-09 0.893000000 1.030e-08 0.935500000 1.023e-07 0.949500000 2.254e-07 0.962000000 4.722e-07 0.975500000 1.113e-06 0.985500000 2.240e-06 0.994000000 4.389e-06 0.997500000 6.029e-06 1.000000000 7.827e-06 }\matchtabe \begin{figure}[htbp] \centering \begin{tikzpicture} \begin{semilogyaxis}[errplot,scale only axis,width=0.86\textwidth,height=6.2cm,ymin=1e-15,ymax=1e-3] \addplot[sRII] table[x=h,y=R2]{\matchtaba}; \addlegendentry{Ramanujan II} \addplot[sI3] table[x=h,y=I3]{\matchtabb}; \addlegendentry{$I_3$ (integer, triple nested)} \addplot[sD] table[x=h,y=S2]{\matchtabc}; \addlegendentry{$S_2$ (double nested)} \addplot[sT] table[x=h,y=S3]{\matchtabd}; \addlegendentry{$S_3$ (triple nested)} \addplot[sQ] table[x=h,y=S4]{\matchtabe}; \addlegendentry{$S_4$ (quadruple nested)} \end{semilogyaxis} \begin{semilogyaxis}[ecc axis,scale only axis,width=0.86\textwidth,height=6.2cm,ymin=1e-15,ymax=1e-3] \addplot[draw=none] coordinates {(0.5,1e-5)}; \end{semilogyaxis} \end{tikzpicture} \caption{Absolute relative error $|\eps|$ of the formulas $S_2$, $S_3$, $S_4$ that agree with the Gauss--Kummer series through $h^5$, $h^8$ and $h^{13}$, compared with $\RII$ (dashed), which agrees through $h^4$, and with the integer formula $I_3$ of Section~\ref{sec:int} (dotted); errors below $10^{-15}$, near the circle, lie below the plotted range. The downward spikes are sign changes of the error; the sampling is refined for $h\ge0.8$ and around them. The error of $S_3$ does not change sign.} \label{fig:match} \end{figure} \section{Minimax formulas}\label{sec:minimax} Finally we dropped all constraints and minimised the maximum relative error over $0\le h\le1$ numerically (for the theory of minimax approximation see, e.g.,~\cite{Powell}), within the form~\eqref{eq:nested}. For triple and quadruple nesting the results are the best we found rather than certified optima (Section~\ref{sec:numerics}). Their errors nearly equioscillate (Figure~\ref{fig:minimax}); the extrema differ by less than $1\%$ for $C_2$ and $C_3$ and by up to $2.4\%$ for $C_4$, whose error also has a smaller lobe next to the circle, for $h<0.035$. The maximum errors are \[ C_2:\ 8.03\times10^{-7},\qquad C_3:\ 4.67\times10^{-8},\qquad C_4:\ 3.90\times10^{-9}. \] These formulas spend their accuracy uniformly. They do not agree with the Gauss--Kummer series beyond the constant term, so near the circle their error is proportional to $h$ and they are less accurate than $\RII$ for small eccentricities: $C_2$, $C_3$ and $C_4$ are more accurate than $\RII$ only for $e$ above about $0.960$, $0.928$ and $0.906$, respectively, apart from isolated points near the zeros of their errors. Of the nested-radical formulas of each depth they have the smallest maximum error; the main formulas of Section~\ref{sec:main} are far more accurate still, in particular for flat ellipses. % Data thinned for typesetting speed: per curve, points within 0.05 pt of the plotted polyline are omitted. \pgfplotstableread{ h R2 0.0025 2.243e-18 0.0050 7.203e-17 0.0075 5.489e-16 0.0100 2.321e-15 0.0125 7.108e-15 0.0150 1.775e-14 0.0175 3.850e-14 0.0200 7.533e-14 0.0225 1.362e-13 0.0250 2.315e-13 0.0300 5.803e-13 0.034619503 1.195e-12 0.0375 1.790e-12 0.0425 3.371e-12 0.0475 5.922e-12 0.0525 9.838e-12 0.0575 1.562e-11 0.0625 2.387e-11 0.0700 4.254e-11 0.0775 7.155e-11 0.0850 1.148e-10 0.0925 1.772e-10 0.1000 2.647e-10 0.1075 3.844e-10 0.1175 6.090e-10 0.1275 9.304e-10 0.1375 1.379e-09 0.1475 1.989e-09 0.1600 3.048e-09 0.1725 4.529e-09 0.1850 6.558e-09 0.1975 9.283e-09 0.2100 1.288e-08 0.2225 1.757e-08 0.235645838 2.394e-08 0.2500 3.298e-08 0.2675 4.769e-08 0.2850 6.755e-08 0.3025 9.393e-08 0.3200 1.285e-07 0.338363748 1.759e-07 0.3750 3.157e-07 0.3975 4.419e-07 0.4175 5.884e-07 0.4525 9.477e-07 0.4900 1.533e-06 0.5325 2.565e-06 0.5775 4.299e-06 0.6200 6.854e-06 0.6750 1.225e-05 0.852301599 7.373e-05 0.910000000 1.347e-04 0.940500000 1.886e-04 0.964500000 2.499e-04 0.984500000 3.221e-04 1.000000000 4.023e-04 }\minitaba \pgfplotstableread{ h I3 0.0025 1.189e-20 0.0050 3.622e-19 0.0075 2.610e-18 0.0100 1.040e-17 0.0125 2.991e-17 0.0150 6.982e-17 0.0175 1.409e-16 0.0200 2.552e-16 0.0225 4.242e-16 0.0250 6.578e-16 0.0275 9.611e-16 0.0300 1.332e-15 0.0325 1.758e-15 0.034619503 2.142e-15 0.0375 2.647e-15 0.0400 2.993e-15 0.0425 3.151e-15 0.0450 2.985e-15 0.0475 2.318e-15 0.0500 9.225e-16 0.0525 1.486e-15 0.0550 5.260e-15 0.0575 1.082e-14 0.0600 1.869e-14 0.0625 2.946e-14 0.0675 6.270e-14 0.0700 8.696e-14 0.0750 1.563e-13 0.0825 3.341e-13 0.0875 5.234e-13 0.0925 7.913e-13 0.0975 1.162e-12 0.1050 1.975e-12 0.1150 3.741e-12 0.1250 6.654e-12 0.1375 1.275e-11 0.1475 2.049e-11 0.1600 3.537e-11 0.1725 5.844e-11 0.1875 1.018e-10 0.2025 1.695e-10 0.2175 2.721e-10 0.2300 3.938e-10 0.2425 5.589e-10 0.2575 8.314e-10 0.2725 1.210e-09 0.2900 1.828e-09 0.3050 2.556e-09 0.3250 3.901e-09 0.3425 5.537e-09 0.3625 8.096e-09 0.3825 1.161e-08 0.4025 1.637e-08 0.4225 2.272e-08 0.4425 3.109e-08 0.4650 4.357e-08 0.4875 6.016e-08 0.5125 8.474e-08 0.5425 1.253e-07 0.5675 1.708e-07 0.5950 2.366e-07 0.6225 3.227e-07 0.6550 4.567e-07 0.6825 6.028e-07 0.7125 8.011e-07 0.7400 1.021e-06 0.7650 1.249e-06 0.7875 1.472e-06 0.810000000 1.697e-06 0.827500000 1.859e-06 0.844500000 1.987e-06 0.860000000 2.058e-06 0.874500000 2.062e-06 0.881500000 2.034e-06 0.889000000 1.977e-06 0.894500000 1.914e-06 0.900500000 1.823e-06 0.905000000 1.737e-06 0.910500000 1.609e-06 0.914500000 1.499e-06 0.918741837 1.366e-06 0.922000000 1.251e-06 0.925500000 1.115e-06 0.929000000 9.650e-07 0.932000000 8.256e-07 0.934500000 7.013e-07 0.936500000 5.967e-07 0.938500000 4.872e-07 0.940000000 4.021e-07 0.941500000 3.144e-07 0.942500000 2.544e-07 0.944000000 1.624e-07 0.945000000 9.962e-08 0.946000000 3.578e-08 0.946453362 6.490e-09 0.946554362 6.496e-11 0.946653362 6.501e-09 0.947000000 2.912e-08 0.947500000 6.196e-08 0.948000000 9.505e-08 0.949000000 1.620e-07 0.950500000 2.642e-07 0.952000000 3.684e-07 0.954000000 5.101e-07 0.956000000 6.545e-07 0.959000000 8.747e-07 0.962500000 1.134e-06 0.966500000 1.424e-06 0.970500000 1.695e-06 0.972591448 1.823e-06 0.975000000 1.951e-06 0.977000000 2.039e-06 0.979500000 2.115e-06 0.981141586 2.139e-06 0.983500000 2.127e-06 0.985000000 2.084e-06 0.986500000 2.007e-06 0.988000000 1.891e-06 0.989000000 1.787e-06 0.991000000 1.505e-06 0.992000000 1.318e-06 0.992838618 1.135e-06 0.994000000 8.342e-07 0.995000000 5.240e-07 0.995500000 3.486e-07 0.996000000 1.581e-07 0.996335283 2.109e-08 0.996386283 4.237e-10 0.996485283 4.272e-08 0.997000000 2.745e-07 0.998041959 8.120e-07 0.999000000 1.406e-06 1.000000000 2.173e-06 }\minitabb \pgfplotstableread{ h C2 0.0025 2.891e-08 0.0050 5.723e-08 0.0075 8.498e-08 0.0100 1.121e-07 0.0125 1.387e-07 0.0150 1.648e-07 0.0175 1.902e-07 0.0225 2.394e-07 0.0275 2.864e-07 0.0325 3.311e-07 0.0375 3.736e-07 0.0450 4.333e-07 0.0525 4.882e-07 0.0600 5.384e-07 0.0700 5.980e-07 0.0800 6.495e-07 0.0925 7.030e-07 0.1075 7.514e-07 0.1225 7.836e-07 0.1375 8.003e-07 0.1550 8.012e-07 0.1725 7.836e-07 0.1900 7.490e-07 0.2050 7.068e-07 0.2200 6.542e-07 0.234182004 5.959e-07 0.2475 5.342e-07 0.2600 4.710e-07 0.2725 4.033e-07 0.2825 3.464e-07 0.2925 2.874e-07 0.3000 2.420e-07 0.3075 1.957e-07 0.3125 1.645e-07 0.3150 1.488e-07 0.3200 1.172e-07 0.3225 1.014e-07 0.3250 8.547e-08 0.3275 6.953e-08 0.3300 5.357e-08 0.3325 3.758e-08 0.3350 2.157e-08 0.3375 5.549e-09 0.338165748 1.282e-09 0.338366748 6.410e-12 0.338565748 1.282e-09 0.3400 1.048e-08 0.3425 2.650e-08 0.3450 4.252e-08 0.3475 5.853e-08 0.3500 7.451e-08 0.3525 9.048e-08 0.3550 1.064e-07 0.3575 1.223e-07 0.3625 1.540e-07 0.3650 1.697e-07 0.3700 2.011e-07 0.3750 2.321e-07 0.3800 2.628e-07 0.3900 3.231e-07 0.4025 3.956e-07 0.4100 4.374e-07 0.4175 4.777e-07 0.4325 5.533e-07 0.4500 6.314e-07 0.4675 6.969e-07 0.4875 7.540e-07 0.5100 7.928e-07 0.5300 8.022e-07 0.5500 7.862e-07 0.5700 7.436e-07 0.5875 6.841e-07 0.6050 6.040e-07 0.6125 5.635e-07 0.6200 5.194e-07 0.6325 4.384e-07 0.6425 3.671e-07 0.6475 3.295e-07 0.6525 2.906e-07 0.6575 2.506e-07 0.6600 2.301e-07 0.6650 1.885e-07 0.6675 1.673e-07 0.6700 1.459e-07 0.6725 1.243e-07 0.6750 1.025e-07 0.6775 8.047e-08 0.6800 5.829e-08 0.6825 3.595e-08 0.6850 1.347e-08 0.686290645 1.810e-09 0.686491645 9.050e-12 0.686690645 1.810e-09 0.6875 9.144e-09 0.6900 3.187e-08 0.6925 5.469e-08 0.6950 7.759e-08 0.6975 1.005e-07 0.7000 1.236e-07 0.7025 1.466e-07 0.7050 1.696e-07 0.7100 2.156e-07 0.7150 2.614e-07 0.7225 3.293e-07 0.7275 3.737e-07 0.7325 4.173e-07 0.7425 5.009e-07 0.7525 5.785e-07 0.7650 6.638e-07 0.7775 7.325e-07 0.7900 7.801e-07 0.803000000 8.026e-07 0.814500000 7.953e-07 0.826000000 7.591e-07 0.835500000 7.053e-07 0.845000000 6.285e-07 0.853000000 5.454e-07 0.856500000 5.038e-07 0.860000000 4.589e-07 0.863000000 4.180e-07 0.866500000 3.674e-07 0.869000000 3.294e-07 0.871500000 2.899e-07 0.874500000 2.407e-07 0.877000000 1.982e-07 0.879000000 1.633e-07 0.881000000 1.276e-07 0.882500000 1.004e-07 0.884000000 7.274e-08 0.885000000 5.413e-08 0.886000000 3.536e-08 0.887000000 1.645e-08 0.887664359 3.816e-09 0.887865359 1.909e-11 0.888000000 2.591e-09 0.888500000 1.216e-08 0.889000000 2.176e-08 0.890000000 4.105e-08 0.891000000 6.045e-08 0.892000000 7.994e-08 0.893500000 1.093e-07 0.895000000 1.389e-07 0.896500000 1.686e-07 0.898500000 2.083e-07 0.901500000 2.679e-07 0.905000000 3.370e-07 0.909000000 4.146e-07 0.913500000 4.987e-07 0.918441837 5.850e-07 0.923500000 6.635e-07 0.929000000 7.335e-07 0.934500000 7.821e-07 0.939500000 8.023e-07 0.944500000 7.946e-07 0.949000000 7.590e-07 0.953000000 7.013e-07 0.956500000 6.285e-07 0.960000000 5.331e-07 0.962500000 4.506e-07 0.965000000 3.559e-07 0.967000000 2.714e-07 0.969000000 1.795e-07 0.970500000 1.059e-07 0.971500000 5.480e-08 0.972000000 2.869e-08 0.972341448 1.064e-08 0.972542448 5.335e-11 0.972741448 1.070e-08 0.973168596 3.372e-08 0.974000000 7.917e-08 0.975500000 1.630e-07 0.976500000 2.199e-07 0.978000000 3.060e-07 0.979500000 3.920e-07 0.981141586 4.842e-07 0.983000000 5.831e-07 0.985000000 6.779e-07 0.987500000 7.672e-07 0.988500000 7.895e-07 0.989500000 8.014e-07 0.990500000 8.008e-07 0.991500000 7.849e-07 0.992838618 7.339e-07 0.994000000 6.550e-07 0.995000000 5.544e-07 0.996000000 4.161e-07 0.996585283 3.140e-07 0.997000000 2.304e-07 0.997500000 1.158e-07 0.997741959 5.419e-08 0.997942959 2.788e-10 0.997991959 1.404e-08 0.998209687 7.756e-08 0.999000000 3.454e-07 1.000000000 8.008e-07 }\minitabc \pgfplotstableread{ h C3 0.0025 2.659e-09 0.0050 5.226e-09 0.0075 7.700e-09 0.0100 1.008e-08 0.0125 1.238e-08 0.0150 1.459e-08 0.0175 1.671e-08 0.0200 1.874e-08 0.0225 2.069e-08 0.0275 2.435e-08 0.0325 2.769e-08 0.0375 3.071e-08 0.0425 3.343e-08 0.0500 3.697e-08 0.0550 3.898e-08 0.0625 4.150e-08 0.0725 4.398e-08 0.0825 4.552e-08 0.0925 4.619e-08 0.1025 4.606e-08 0.1125 4.521e-08 0.1250 4.323e-08 0.1375 4.035e-08 0.1475 3.749e-08 0.1575 3.419e-08 0.1675 3.052e-08 0.1775 2.653e-08 0.1850 2.337e-08 0.1925 2.009e-08 0.2000 1.672e-08 0.2050 1.442e-08 0.2100 1.210e-08 0.2150 9.759e-09 0.2175 8.582e-09 0.2200 7.402e-09 0.2225 6.220e-09 0.2250 5.036e-09 0.2275 3.852e-09 0.2300 2.668e-09 0.2325 1.485e-09 0.234032004 7.600e-10 0.2350 3.026e-10 0.235540838 4.722e-11 0.235641838 4.721e-13 0.235840838 9.442e-11 0.2375 8.771e-10 0.2400 2.054e-09 0.2425 3.227e-09 0.2450 4.396e-09 0.2475 5.560e-09 0.2500 6.719e-09 0.2525 7.871e-09 0.2550 9.016e-09 0.2600 1.128e-08 0.2650 1.352e-08 0.2675 1.462e-08 0.2725 1.679e-08 0.2775 1.891e-08 0.2825 2.099e-08 0.2875 2.300e-08 0.2925 2.496e-08 0.3000 2.778e-08 0.3125 3.212e-08 0.3275 3.667e-08 0.3425 4.044e-08 0.3600 4.376e-08 0.3775 4.582e-08 0.3975 4.658e-08 0.4150 4.582e-08 0.434618316 4.338e-08 0.4525 3.974e-08 0.4625 3.715e-08 0.4700 3.495e-08 0.4850 2.996e-08 0.4975 2.524e-08 0.5075 2.114e-08 0.5125 1.899e-08 0.5175 1.679e-08 0.5250 1.338e-08 0.5300 1.105e-08 0.5325 9.868e-09 0.5350 8.679e-09 0.5375 7.481e-09 0.5400 6.274e-09 0.5425 5.061e-09 0.5450 3.841e-09 0.5475 2.616e-09 0.5500 1.386e-09 0.5525 1.516e-10 0.552756482 2.473e-11 0.552807482 4.946e-13 0.553006482 9.893e-11 0.5550 1.086e-09 0.5575 2.326e-09 0.5600 3.568e-09 0.5625 4.810e-09 0.5650 6.052e-09 0.5675 7.294e-09 0.5700 8.533e-09 0.5750 1.100e-08 0.5800 1.345e-08 0.5825 1.467e-08 0.5875 1.708e-08 0.5950 2.062e-08 0.6000 2.293e-08 0.6050 2.517e-08 0.614298098 2.917e-08 0.6250 3.341e-08 0.6350 3.698e-08 0.6475 4.077e-08 0.6600 4.370e-08 0.6725 4.565e-08 0.686290645 4.651e-08 0.6975 4.612e-08 0.7100 4.444e-08 0.7225 4.138e-08 0.7325 3.792e-08 0.7400 3.473e-08 0.7450 3.233e-08 0.753997617 2.746e-08 0.7575 2.538e-08 0.7625 2.224e-08 0.7675 1.891e-08 0.7700 1.717e-08 0.7725 1.540e-08 0.7750 1.358e-08 0.7775 1.173e-08 0.7800 9.839e-09 0.7825 7.915e-09 0.7850 5.959e-09 0.7875 3.975e-09 0.7900 1.966e-09 0.792219342 1.632e-10 0.792420342 8.165e-13 0.792619342 1.634e-10 0.7950 2.117e-09 0.7975 4.183e-09 0.800500000 6.677e-09 0.803000000 8.763e-09 0.805500000 1.085e-08 0.808000000 1.294e-08 0.811500000 1.585e-08 0.816500000 1.995e-08 0.821500000 2.396e-08 0.828000000 2.894e-08 0.835000000 3.389e-08 0.842500000 3.855e-08 0.850500000 4.255e-08 0.858500000 4.527e-08 0.865500000 4.638e-08 0.872500000 4.608e-08 0.879500000 4.420e-08 0.886000000 4.089e-08 0.891500000 3.682e-08 0.896500000 3.209e-08 0.901000000 2.698e-08 0.905000000 2.178e-08 0.908000000 1.749e-08 0.910000000 1.446e-08 0.912000000 1.130e-08 0.913500000 8.846e-09 0.914500000 7.177e-09 0.915500000 5.481e-09 0.916500000 3.760e-09 0.917500000 2.017e-09 0.918000000 1.137e-09 0.918500000 2.519e-10 0.918642837 1.777e-12 0.918741837 1.778e-10 0.919000000 6.378e-10 0.919500000 1.532e-09 0.920500000 3.333e-09 0.922000000 6.060e-09 0.924000000 9.732e-09 0.926500000 1.435e-08 0.928500000 1.802e-08 0.931000000 2.256e-08 0.933500000 2.695e-08 0.936500000 3.195e-08 0.939500000 3.650e-08 0.943000000 4.102e-08 0.946533362 4.443e-08 0.949500000 4.615e-08 0.952500000 4.659e-08 0.955500000 4.550e-08 0.958000000 4.325e-08 0.960500000 3.966e-08 0.963000000 3.462e-08 0.965000000 2.951e-08 0.966500000 2.503e-08 0.968000000 2.002e-08 0.969500000 1.450e-08 0.971000000 8.495e-09 0.972000000 4.258e-09 0.972341448 2.773e-09 0.972868596 4.459e-10 0.972969596 4.465e-12 0.973068596 4.472e-10 0.973500000 2.391e-09 0.974500000 6.973e-09 0.976000000 1.397e-08 0.977500000 2.097e-08 0.979500000 2.992e-08 0.980841586 3.537e-08 0.982000000 3.950e-08 0.983500000 4.372e-08 0.984500000 4.561e-08 0.985500000 4.657e-08 0.986500000 4.641e-08 0.987500000 4.496e-08 0.988500000 4.200e-08 0.990000000 3.435e-08 0.991000000 2.686e-08 0.991500000 2.237e-08 0.992500000 1.190e-08 0.992938618 6.712e-09 0.993238618 2.974e-09 0.993470556 1.304e-11 0.993569556 1.311e-09 0.994000000 7.099e-09 0.995000000 2.107e-08 0.995500000 2.797e-08 0.996387283 3.897e-08 0.997000000 4.446e-08 0.997500000 4.661e-08 0.997741959 4.656e-08 0.998041959 4.519e-08 0.998500000 3.944e-08 0.999000000 2.592e-08 0.999408079 6.407e-09 0.999509079 6.798e-11 0.999608079 7.218e-09 1.000000000 4.660e-08 }\minitabd \pgfplotstableread{ h C4 0.0025 1.138e-10 0.0050 2.052e-10 0.0075 2.755e-10 0.0100 3.260e-10 0.0125 3.579e-10 0.0150 3.724e-10 0.0175 3.706e-10 0.0200 3.537e-10 0.0225 3.228e-10 0.0250 2.789e-10 0.0275 2.231e-10 0.0300 1.563e-10 0.0325 7.945e-11 0.034619503 7.141e-12 0.034820503 3.584e-14 0.035019503 7.194e-12 0.0375 1.006e-10 0.0400 2.021e-10 0.0425 3.102e-10 0.0450 4.239e-10 0.0475 5.426e-10 0.0500 6.656e-10 0.0525 7.921e-10 0.0575 1.053e-09 0.0600 1.186e-09 0.0650 1.454e-09 0.0675 1.589e-09 0.0725 1.855e-09 0.0800 2.241e-09 0.0850 2.485e-09 0.0900 2.714e-09 0.1000 3.120e-09 0.1100 3.442e-09 0.1200 3.669e-09 0.1325 3.809e-09 0.1450 3.785e-09 0.1575 3.602e-09 0.1675 3.347e-09 0.1775 3.006e-09 0.1875 2.587e-09 0.1925 2.353e-09 0.1975 2.105e-09 0.2050 1.708e-09 0.2100 1.430e-09 0.2125 1.288e-09 0.2150 1.145e-09 0.2175 9.990e-10 0.2200 8.521e-10 0.2225 7.039e-10 0.2250 5.549e-10 0.2275 4.051e-10 0.2300 2.548e-10 0.2325 1.043e-10 0.234032004 1.204e-11 0.234233004 6.021e-14 0.234432004 1.204e-11 0.2350 4.623e-11 0.235645838 8.510e-11 0.2375 1.966e-10 0.2400 3.464e-10 0.2425 4.957e-10 0.2450 6.440e-10 0.2475 7.912e-10 0.2500 9.371e-10 0.2525 1.081e-09 0.2550 1.224e-09 0.2600 1.503e-09 0.2625 1.639e-09 0.2675 1.903e-09 0.2750 2.277e-09 0.2825 2.619e-09 0.2925 3.018e-09 0.3025 3.344e-09 0.3125 3.589e-09 0.3250 3.773e-09 0.3375 3.816e-09 0.3475 3.746e-09 0.3600 3.531e-09 0.3700 3.262e-09 0.3800 2.911e-09 0.3875 2.600e-09 0.3950 2.252e-09 0.4025 1.871e-09 0.4050 1.738e-09 0.4100 1.463e-09 0.4150 1.177e-09 0.4175 1.032e-09 0.4200 8.842e-10 0.4225 7.350e-10 0.4250 5.845e-10 0.4275 4.329e-10 0.4300 2.803e-10 0.4325 1.271e-10 0.434368316 1.230e-11 0.434569316 6.150e-14 0.434618316 3.075e-12 0.4350 2.655e-11 0.4375 1.804e-10 0.4400 3.342e-10 0.4425 4.876e-10 0.4450 6.405e-10 0.4475 7.926e-10 0.4500 9.436e-10 0.4525 1.093e-09 0.4550 1.242e-09 0.4600 1.532e-09 0.4650 1.814e-09 0.4700 2.084e-09 0.4775 2.464e-09 0.4850 2.808e-09 0.4925 3.110e-09 0.5000 3.364e-09 0.5100 3.622e-09 0.5175 3.747e-09 0.5275 3.818e-09 0.5375 3.775e-09 0.5450 3.665e-09 0.552808482 3.481e-09 0.5625 3.155e-09 0.5675 2.947e-09 0.5725 2.713e-09 0.5800 2.317e-09 0.5850 2.025e-09 0.5875 1.872e-09 0.5925 1.551e-09 0.5950 1.385e-09 0.5975 1.215e-09 0.6000 1.041e-09 0.6025 8.643e-10 0.6050 6.851e-10 0.6075 5.035e-10 0.6100 3.201e-10 0.6125 1.352e-10 0.614118098 1.489e-11 0.614319098 7.447e-14 0.614418098 7.448e-12 0.6150 5.081e-11 0.6175 2.374e-10 0.6200 4.242e-10 0.6225 6.108e-10 0.6250 7.966e-10 0.6275 9.813e-10 0.6300 1.164e-09 0.6325 1.345e-09 0.6350 1.524e-09 0.6375 1.699e-09 0.6425 2.038e-09 0.6475 2.359e-09 0.6525 2.657e-09 0.6575 2.930e-09 0.6650 3.282e-09 0.6700 3.473e-09 0.6775 3.686e-09 0.6850 3.802e-09 0.6925 3.814e-09 0.7000 3.715e-09 0.7050 3.586e-09 0.7100 3.407e-09 0.7150 3.178e-09 0.7225 2.744e-09 0.7275 2.398e-09 0.7300 2.209e-09 0.7350 1.802e-09 0.7375 1.586e-09 0.7400 1.362e-09 0.7425 1.130e-09 0.7450 8.923e-10 0.7475 6.490e-10 0.7500 4.012e-10 0.7525 1.498e-10 0.753777617 2.032e-11 0.753978617 1.017e-13 0.754177617 2.034e-11 0.7550 1.041e-10 0.7575 3.594e-10 0.7600 6.151e-10 0.7625 8.699e-10 0.7650 1.123e-09 0.7675 1.372e-09 0.7700 1.617e-09 0.7725 1.856e-09 0.7750 2.087e-09 0.7800 2.523e-09 0.7850 2.912e-09 0.7900 3.245e-09 0.7950 3.511e-09 0.800000000 3.699e-09 0.805500000 3.806e-09 0.811000000 3.798e-09 0.816000000 3.684e-09 0.820500000 3.493e-09 0.825500000 3.181e-09 0.829500000 2.857e-09 0.833500000 2.471e-09 0.837000000 2.085e-09 0.840000000 1.722e-09 0.842500000 1.399e-09 0.844500000 1.129e-09 0.847000000 7.786e-10 0.849000000 4.900e-10 0.850500000 2.696e-10 0.851500000 1.212e-10 0.852000000 4.659e-11 0.852211599 1.496e-11 0.852312599 1.496e-13 0.852511599 2.994e-11 0.853000000 1.032e-10 0.854000000 2.536e-10 0.855500000 4.798e-10 0.856500000 6.307e-10 0.858000000 8.566e-10 0.859500000 1.081e-09 0.861500000 1.377e-09 0.863500000 1.667e-09 0.866000000 2.017e-09 0.869000000 2.413e-09 0.872000000 2.776e-09 0.875000000 3.097e-09 0.878500000 3.407e-09 0.882000000 3.637e-09 0.885500000 3.775e-09 0.889500000 3.805e-09 0.893000000 3.711e-09 0.896500000 3.499e-09 0.899500000 3.221e-09 0.902000000 2.922e-09 0.904500000 2.564e-09 0.907000000 2.150e-09 0.909000000 1.782e-09 0.910500000 1.486e-09 0.912000000 1.176e-09 0.913500000 8.521e-10 0.915000000 5.174e-10 0.916000000 2.892e-10 0.916500000 1.738e-10 0.917000000 5.782e-11 0.917148222 2.331e-11 0.917249222 2.332e-13 0.917348222 2.333e-11 0.917500000 5.879e-11 0.918000000 1.759e-10 0.919000000 4.111e-10 0.920500000 7.649e-10 0.922500000 1.233e-09 0.924000000 1.578e-09 0.925500000 1.912e-09 0.927000000 2.233e-09 0.929000000 2.632e-09 0.931000000 2.989e-09 0.933000000 3.295e-09 0.935000000 3.540e-09 0.937500000 3.744e-09 0.940000000 3.818e-09 0.942000000 3.774e-09 0.944000000 3.631e-09 0.946000000 3.384e-09 0.947500000 3.130e-09 0.949000000 2.817e-09 0.950500000 2.447e-09 0.952000000 2.023e-09 0.954000000 1.381e-09 0.955000000 1.032e-09 0.956000000 6.670e-10 0.957000000 2.890e-10 0.957500000 9.605e-11 0.957646939 3.895e-11 0.957747939 3.899e-13 0.957846939 3.902e-11 0.958000000 9.888e-11 0.958500000 2.953e-10 0.959000000 4.928e-10 0.960000000 8.889e-10 0.961000000 1.282e-09 0.962000000 1.669e-09 0.964000000 2.398e-09 0.965000000 2.729e-09 0.966500000 3.165e-09 0.967500000 3.407e-09 0.969000000 3.679e-09 0.970000000 3.789e-09 0.971500000 3.832e-09 0.972741448 3.745e-09 0.974000000 3.531e-09 0.975000000 3.268e-09 0.976000000 2.920e-09 0.977500000 2.241e-09 0.979000000 1.387e-09 0.980000000 7.335e-10 0.980500000 3.870e-10 0.980841586 1.441e-10 0.981042586 7.238e-13 0.981241586 1.453e-10 0.981500000 3.346e-10 0.982000000 7.041e-10 0.983000000 1.444e-09 0.984000000 2.158e-09 0.985000000 2.808e-09 0.986000000 3.349e-09 0.986500000 3.563e-09 0.987500000 3.846e-09 0.988000000 3.900e-09 0.988500000 3.887e-09 0.989000000 3.800e-09 0.990000000 3.383e-09 0.991000000 2.613e-09 0.991500000 2.093e-09 0.992000000 1.487e-09 0.992500000 8.050e-10 0.992838618 3.060e-10 0.993039618 1.547e-12 0.993138618 1.555e-10 0.993419556 5.992e-10 0.994000000 1.526e-09 0.995000000 2.985e-09 0.995500000 3.524e-09 0.996185283 3.868e-09 0.996585283 3.766e-09 0.997000000 3.356e-09 0.997741959 1.689e-09 0.998141959 2.741e-10 0.998209687 4.042e-12 0.998310687 4.114e-10 0.998500000 1.218e-09 0.999000000 3.230e-09 0.999308079 3.857e-09 0.999458079 3.725e-09 0.999708079 2.258e-09 0.999862263 2.003e-11 1.000000000 3.850e-09 }\minitabe \begin{figure}[htbp] \centering \begin{tikzpicture} \begin{semilogyaxis}[errplot,scale only axis,width=0.86\textwidth,height=6.2cm,ymin=1e-12,ymax=1e-3] \addplot[sRII] table[x=h,y=R2]{\minitaba}; \addlegendentry{Ramanujan II} \addplot[sI3] table[x=h,y=I3]{\minitabb}; \addlegendentry{$I_3$ (integer, triple nested)} \addplot[sD] table[x=h,y=C2]{\minitabc}; \addlegendentry{$C_2$ (double nested)} \addplot[sT] table[x=h,y=C3]{\minitabd}; \addlegendentry{$C_3$ (triple nested)} \addplot[sQ] table[x=h,y=C4]{\minitabe}; \addlegendentry{$C_4$ (quadruple nested)} \end{semilogyaxis} \begin{semilogyaxis}[ecc axis,scale only axis,width=0.86\textwidth,height=6.2cm,ymin=1e-12,ymax=1e-3] \addplot[draw=none] coordinates {(0.5,1e-5)}; \end{semilogyaxis} \end{tikzpicture} \caption{Absolute relative error $|\eps|$ of the minimax formulas $C_2$, $C_3$, $C_4$ (for $C_3$ and $C_4$ the best found), compared with $\RII$ (dashed) and the integer formula $I_3$ of Section~\ref{sec:int} (dotted); errors below $10^{-12}$, near the circle, lie below the plotted range. The downward spikes are sign changes of the error; the sampling is refined for $h\ge0.8$ and around them. The five sign changes with $h>0.996$ (one each of $I_3$, $C_2$ and $C_3$, and two of $C_4$) merge at the right edge.} \label{fig:minimax} \end{figure} \section{Closed-form values}\label{sec:points} Closed forms for $P$ exist at the \emph{singular moduli}. For a modulus $00$ there is exactly one modulus $k_N$ with \[ \frac{K'(k_N)}{K(k_N)}=\sqrt N , \] for a positive integer $N$ it is called the $N$-th singular modulus (or singular value). Its complement is $k_N'=k_{1/N}$. Equivalently, the nome $q=e^{-\pi K'/K}$ equals $e^{-\pi\sqrt N}$, and the period ratio of the corresponding elliptic curve is $\tau=\mathrm{i}\sqrt N$. For a positive integer $N$ this curve has complex multiplication, and this arithmetic structure makes $k_N$ an algebraic number; for instance $k_1=1/\sqrt2$ and $k_2=\sqrt2-1$. Moreover, the Chowla--Selberg formula expresses $K(k_N)$ through algebraic numbers, powers of $\pi$ and values of the Gamma function at rational arguments~\cite{ChowlaSelberg}, and the elliptic alpha function \[ \alpha(N)=\frac{\pi}{4K(k_N)^2}-\sqrt N\Bigl(\frac{E(k_N)}{K(k_N)}-1\Bigr) \] is again algebraic~\cite[Ch.~5]{BorweinBorwein}. Solving for $E$ gives closed forms for the complete integrals of the second kind at $k_N$ and $k_N'$: \[ E(k_N)=\Bigl(1-\frac{\alpha(N)}{\sqrt N}\Bigr)K_N+\frac{\pi}{4\sqrt N\,K_N},\qquad E(k_N')=\alpha(N)\,K_N+\frac{\pi}{4K_N},\qquad K_N=K(k_N), \] where the second identity follows from the first and Legendre's relation. For $N=1,2,3,4$, \[ \begin{aligned} k_1&=\tfrac{1}{\sqrt2}, & \alpha(1)&=\tfrac12, & K_1&=\frac{\Gamma(\frac14)^2}{4\sqrt\pi},\\ k_2&=\sqrt2-1, & \alpha(2)&=\sqrt2-1, & K_2&=\frac{\sqrt{\sqrt2+1}\;\Gamma(\frac18)\Gamma(\frac38)}{2^{13/4}\sqrt\pi},\\ k_3&=\tfrac{\sqrt6-\sqrt2}{4}=\sin15^\circ, & \alpha(3)&=\tfrac{\sqrt3-1}{2}, & K_3&=\frac{3^{1/4}\,\Gamma(\frac13)^3}{2^{7/3}\pi},\\ k_4&=3-2\sqrt2, & \alpha(4)&=6-4\sqrt2, & K_4&=\frac{2+\sqrt2}{4}\,K_1 . \end{aligned} \] Since $P=4aE(e)$, these four values of $N$ give seven eccentricities in $(0,1)$ with closed-form perimeters (with $k_1=k_1'$), listed in Table~\ref{tab:points}; every further positive integer $N$ gives two more. With the lemniscate constant $\lemn=\Gamma(\frac14)^2/(2\sqrt{2\pi})=\sqrt2\,K_1$, three of them take a particularly simple form: \begin{align*} P\bigl(e=\tfrac{1}{\sqrt2}\bigr)&=\sqrt2\,a\Bigl(\lemn+\frac{\pi}{\lemn}\Bigr),\\ P\bigl(e=3-2\sqrt2\bigr)&=2a\Bigl(\lemn+\frac{(\sqrt2-1)\pi}{\lemn}\Bigr),\\ P\bigl(e=2\sqrt{3\sqrt2-4}\bigr)&=2(\sqrt2-1)\,a\Bigl(\lemn+\frac{2\pi}{\lemn}\Bigr). \end{align*} We evaluated these expressions in 80-digit arithmetic, with the Gamma function computed from Stirling's series, and checked them against the AGM; the two agree to at least 76 significant digits. Table~\ref{tab:pointerr} lists the relative errors of all formulas at these points, computed with 80 significant digits, so that even errors far below double precision are resolved; for $B_3$, $B_4$, $S_3$ and $S_4$ the matched coefficients were computed to high precision (Section~\ref{sec:numerics}). \begin{table}[htbp] \centering \small \renewcommand{\arraystretch}{1.6} \caption{The seven eccentricities $e$ with closed-form perimeters for $N=1,\dots,4$, the corresponding axis ratio $b/a$, the value of $h$, and $P/a=4E(e)$. Here $K_N=K(k_N)$ and $\lemn=\sqrt2\,K_1$ are as in the text.} \label{tab:points} \begin{tabular}{@{}cccccl@{}} \toprule & $e$ & $b/a$ & $h$ & $P/a$ & numerical value of $P/a$\\ \midrule $k_1$ & $1/\sqrt2$ & $1/\sqrt2$ & $0.029437$ & $2K_1+\dfrac{\pi}{K_1}=\sqrt2\Bigl(\lemn+\dfrac{\pi}{\lemn}\Bigr)$ & $5.402575524190702010081$\\ $k_2$ & $\sqrt2-1$ & $\sqrt{2\sqrt2-2}$ & $0.002211$ & $2\sqrt2\,K_2+\dfrac{\pi}{\sqrt2\,K_2}$ & $6.004324182524975645981$\\ $k_2'$ & $\sqrt{2\sqrt2-2}$ & $\sqrt2-1$ & $0.171573$ & $4(\sqrt2-1)K_2+\dfrac{\pi}{K_2}$ & $4.635590099210058269657$\\ $k_3$ & $\frac{\sqrt6-\sqrt2}{4}$ & $\frac{\sqrt6+\sqrt2}{4}$ & $0.000300$ & $\dfrac{2(3+\sqrt3)}{3}K_3+\dfrac{\pi}{\sqrt3\,K_3}$ & $6.176601987658693464746$\\ $k_3'$ & $\frac{\sqrt6+\sqrt2}{4}$ & $\frac{\sqrt6-\sqrt2}{4}$ & $0.346674$ & $2(\sqrt3-1)K_3+\dfrac{\pi}{K_3}$ & $4.305620452305612100270$\\ $k_4$ & $3-2\sqrt2$ & $2\sqrt{3\sqrt2-4}$ & $0.000056$ & $2\Bigl(\lemn+\dfrac{(\sqrt2-1)\pi}{\lemn}\Bigr)$ & $6.236686978288971552476$\\ $k_4'$ & $2\sqrt{3\sqrt2-4}$ & $3-2\sqrt2$ & $0.500000$ & $2(\sqrt2-1)\Bigl(\lemn+\dfrac{2\pi}{\lemn}\Bigr)$ & $4.157327340030711915898$\\ \bottomrule \end{tabular} \end{table} \begin{table}[htbp] \centering \footnotesize \setlength{\tabcolsep}{4pt} \caption{Relative error $\eps$ of each formula at the closed-form points of Table~\ref{tab:points}, computed with 80 significant digits (for $B_3$, $B_4$, $S_3$ and $S_4$ with high-precision matched coefficients, see Section~\ref{sec:numerics}). Here $x\mathrm{e}{k}$ means $x\times10^{k}$.} \label{tab:pointerr} \begin{tabular}{@{}lrrrrrrr@{}} \toprule & $k_4$ & $k_3$ & $k_2$ & $k_1$ & $k_2'$ & $k_3'$ & $k_4'$\\ $e$ & $0.171573$ & $0.258819$ & $0.414214$ & $0.707107$ & $0.910180$ & $0.965926$ & $0.985171$\\ \midrule $\RI$ & $-3.4\mathrm{e}{-16}$ & $-5.3\mathrm{e}{-14}$ & $-2.1\mathrm{e}{-11}$ & $-5.0\mathrm{e}{-8}$ & $-1.1\mathrm{e}{-5}$ & $-9.5\mathrm{e}{-5}$ & $-3.1\mathrm{e}{-4}$\\ $\RII$ & $-1.2\mathrm{e}{-26}$ & $-5.6\mathrm{e}{-23}$ & $-1.2\mathrm{e}{-18}$ & $-5.3\mathrm{e}{-13}$ & $-4.4\mathrm{e}{-9}$ & $-2.0\mathrm{e}{-7}$ & $-1.7\mathrm{e}{-6}$\\ \midrule $A_3$ & $+2.7\mathrm{e}{-42}$ & $+1.9\mathrm{e}{-36}$ & $+1.7\mathrm{e}{-29}$ & $+1.8\mathrm{e}{-20}$ & $+4.1\mathrm{e}{-14}$ & $+2.5\mathrm{e}{-11}$ & $+1.1\mathrm{e}{-9}$\\ $A_4$ & $<10^{-75}$ & $+6.0\mathrm{e}{-74}$ & $+4.5\mathrm{e}{-60}$ & $+5.4\mathrm{e}{-42}$ & $+3.1\mathrm{e}{-29}$ & $+1.3\mathrm{e}{-23}$ & $+2.8\mathrm{e}{-20}$\\ $A_6$ & \multicolumn{7}{c}{below $10^{-75}$ at all seven points}\\ \midrule $I_2$ & $+5.0\mathrm{e}{-27}$ & $+2.3\mathrm{e}{-23}$ & $+4.9\mathrm{e}{-19}$ & $+2.2\mathrm{e}{-13}$ & $+1.9\mathrm{e}{-9}$ & $+8.6\mathrm{e}{-8}$ & $+7.3\mathrm{e}{-7}$\\ $I_3$ & $+6.9\mathrm{e}{-29}$ & $+3.1\mathrm{e}{-25}$ & $+6.5\mathrm{e}{-21}$ & $+1.2\mathrm{e}{-15}$ & $-5.6\mathrm{e}{-11}$ & $-6.0\mathrm{e}{-9}$ & $-7.2\mathrm{e}{-8}$\\ $I_3'$ & $+3.7\mathrm{e}{-27}$ & $+1.7\mathrm{e}{-23}$ & $+3.6\mathrm{e}{-19}$ & $+1.5\mathrm{e}{-13}$ & $+1.1\mathrm{e}{-9}$ & $+3.8\mathrm{e}{-8}$ & $+2.3\mathrm{e}{-7}$\\ $I_3''$ & $+4.6\mathrm{e}{-32}$ & $+1.1\mathrm{e}{-27}$ & $+1.8\mathrm{e}{-22}$ & $+1.0\mathrm{e}{-15}$ & $+4.5\mathrm{e}{-11}$ & $+3.4\mathrm{e}{-9}$ & $+3.1\mathrm{e}{-8}$\\ \midrule $B_2$ & $+4.5\mathrm{e}{-27}$ & $+2.0\mathrm{e}{-23}$ & $+4.4\mathrm{e}{-19}$ & $+1.9\mathrm{e}{-13}$ & $+1.7\mathrm{e}{-9}$ & $+7.7\mathrm{e}{-8}$ & $+6.5\mathrm{e}{-7}$\\ $B_3$ & $-2.7\mathrm{e}{-28}$ & $-1.2\mathrm{e}{-24}$ & $-2.6\mathrm{e}{-20}$ & $-9.9\mathrm{e}{-15}$ & $-2.3\mathrm{e}{-11}$ & $+1.8\mathrm{e}{-9}$ & $+3.0\mathrm{e}{-8}$\\ $B_4$ & $-1.3\mathrm{e}{-27}$ & $-6.0\mathrm{e}{-24}$ & $-1.3\mathrm{e}{-19}$ & $-5.1\mathrm{e}{-14}$ & $-2.4\mathrm{e}{-10}$ & $-4.1\mathrm{e}{-9}$ & $-8.9\mathrm{e}{-9}$\\ \midrule $S_2$ & $+3.4\mathrm{e}{-32}$ & $+8.3\mathrm{e}{-28}$ & $+1.3\mathrm{e}{-22}$ & $+7.4\mathrm{e}{-16}$ & $+2.7\mathrm{e}{-11}$ & $+1.1\mathrm{e}{-9}$ & $-1.0\mathrm{e}{-8}$\\ $S_3$ & $-3.9\mathrm{e}{-46}$ & $-1.5\mathrm{e}{-39}$ & $-9.5\mathrm{e}{-32}$ & $-1.4\mathrm{e}{-21}$ & $-1.7\mathrm{e}{-14}$ & $-2.0\mathrm{e}{-11}$ & $-1.1\mathrm{e}{-9}$\\ $S_4$ & $+7.2\mathrm{e}{-71}$ & $+1.2\mathrm{e}{-60}$ & $+1.7\mathrm{e}{-48}$ & $+1.1\mathrm{e}{-32}$ & $+1.2\mathrm{e}{-21}$ & $+6.7\mathrm{e}{-17}$ & $+3.2\mathrm{e}{-14}$\\ \midrule $C_2$ & $+6.5\mathrm{e}{-10}$ & $+3.5\mathrm{e}{-9}$ & $+2.6\mathrm{e}{-8}$ & $+3.0\mathrm{e}{-7}$ & $+7.9\mathrm{e}{-7}$ & $-5.3\mathrm{e}{-8}$ & $-7.8\mathrm{e}{-7}$\\ $C_3$ & $+6.0\mathrm{e}{-11}$ & $+3.2\mathrm{e}{-10}$ & $+2.4\mathrm{e}{-9}$ & $+2.6\mathrm{e}{-8}$ & $+2.9\mathrm{e}{-8}$ & $-4.1\mathrm{e}{-8}$ & $-2.4\mathrm{e}{-8}$\\ $C_4$ & $-2.8\mathrm{e}{-12}$ & $-1.5\mathrm{e}{-11}$ & $-1.0\mathrm{e}{-10}$ & $-1.7\mathrm{e}{-10}$ & $+3.2\mathrm{e}{-9}$ & $-3.8\mathrm{e}{-9}$ & $+3.4\mathrm{e}{-9}$\\ \bottomrule \end{tabular} \end{table} \section{Summary of accuracy and cost}\label{sec:summary} Table~\ref{tab:summary} collects, for every formula, the order of agreement with the Gauss--Kummer series, the maximum relative error over all eccentricities, the smallest improvement factor over $\RII$, and the estimated cost compared with the AGM steps needed to reach at least the same accuracy. The minimum improvement factor is $\min_{010^{-12}$; and in $80$-digit arithmetic on $480$ points, namely $h=i/400$, $h=10^{-k/4}$ and $h=1-10^{-k/4}$ for $1\le i\le400$ and $1\le k\le40$. This is numerical verification, not a proof. For the real-coefficient formulas $B_3$ and $B_4$ the coefficients $Q_0,\dots,Q_4$ are determined by the matching conditions, given the outer constants and $\delta$ (Section~\ref{sec:dom}); the values in Appendix~\ref{app:const} reproduce them to the $16$ printed digits, which suffices in double precision, but exact agreement with the series through $h^4$ (and hence the comparison with $\RII$ as $e\to0$) requires computing them from the matching conditions. Likewise, all constants of $S_3$ and $S_4$ are determined by the matching conditions, and their very small errors for moderate eccentricities (Section~\ref{sec:match} and Table~\ref{tab:pointerr}) were computed with constants accurate to $70$ digits; with the $16$-digit constants of Appendix~\ref{app:const}, rounding of the constants limits these errors to between about $10^{-22}$ near the circle and $10^{-18}$ at $e=0.9$, which is still far below double-precision resolution. \section{Concluding remarks} The main results of this note are the closed formulas $A_3$, $A_4$ and $A_6$. A few AGM steps written as one expression are accurate for all but very flat ellipses. Legendre's relation rewrites the remaining case exactly in terms of $K$ and two power series in $b/a$; truncating the series and estimating $K$ from the same AGM steps gives an expression that is a short polynomial in $b/a$ apart from the estimate of $K$, and one extra term makes the result continuous. With three, four and six square roots and no loops, this gives formulas whose errors in exact arithmetic lie below the unit roundoff of single, double and quadruple precision for every eccentricity, including the degenerate ellipse, and which are accurate to within about six units of the unit roundoff when evaluated in that precision (for $A_6$, as estimated with $34$-digit decimal arithmetic). The errors of $A_4$ and $A_6$ are many orders of magnitude smaller than those of recent closed formulas~\cite{MoscatoCiezak,AyalaRaggi2025,ELIP}, the most accurate of which has a maximum error of $4.5\times10^{-10}$. Proposition~\ref{prop:conv} shows that the construction is not limited to these three cases: for every switch point, enough AGM steps and series terms give a continuous formula of this kind with any prescribed maximum error, and the error of the continuous formula is at most that of the AGM branch plus twice that of the flat-ellipse branch. Such formulas need only arithmetic operations and square roots and the same few coefficients for every shape, without piecewise coefficient tables, and have no fitted parameters: apart from the integers $N$ and $n$, small integers in the refined estimate of $K$, and the series coefficients, which are dyadic rationals (for $A_3$, $A_4$ and $A_6$ exactly representable even in binary32), they contain only a freely chosen switch point and a continuity coefficient given by the closed formula~\eqref{eq:cont}, which need not be stored to many digits. In our latency model, $A_4$ is faster in double precision than the quadruple-nested formulas and, for flat ellipses ($b/a<0.09$), than an AGM loop iterated to the same accuracy, whose cost grows without bound as $b\to0$; in single precision $A_3$ is the cheapest way we found to reach nearly full precision. Approximations that use a logarithm, such as Cody's Chebyshev approximations of $E$~\cite{Cody1965}, can be faster still. The nested-radical formulas complement these results. Ramanujan's second approximation owes its high order of agreement with the Gauss--Kummer series to the vanishing of two coefficients in the ideal radicand~\eqref{eq:T}, and nesting further square roots is a natural way to continue his construction. With integer coefficients, two more radicals reduce the maximum error by more than two orders of magnitude while keeping the formula short enough to write down. With real coefficients and four radicals, the maximum error drops to $8.98\times10^{-9}$ for formulas that are nowhere less accurate than $\RII$ and to $3.90\times10^{-9}$ for minimax formulas. Within the same number of square roots, the choice between series matching and minimax optimisation is a choice between accuracy for nearly circular ellipses and uniform accuracy. In our latency model these formulas are slower than the main formulas of comparable or better accuracy, but they remain single expressions without branches and with fewer operations, which matters when throughput rather than latency limits the speed. Evaluated in powers of $\sigma=1-h$, they are also accurate in single precision, where the triple-nested $C_3$ is as fast as five AGM steps, beyond which the binary32 AGM does not improve ($2.0\times10^{-6}$ for $b/a\ge10^{-6}$), and about ten times more accurate. \section*{Provenance statement} The results in this note were obtained with the assistance of Claude Opus~5.5 (Anthropic), working under the direction of the author. The model derived the AGM-based formulas and Proposition~\ref{prop:conv} with its proof, carried out the series computations behind Propositions~\ref{prop:local} and~\ref{prop:family}, the searches for integer and real-coefficient formulas, the optimisations, the high-precision verification and the cost estimates, produced the figures, drafted the text and checked the references. The computations were done in Python, in exact rational arithmetic, in arbitrary-precision decimal arithmetic with up to $110$ digits, and in native or exactly emulated binary32 and binary64 floating-point arithmetic. The author is responsible for the content. \begin{thebibliography}{99} \bibitem{AbramowitzStegun} M.~Abramowitz and I.~A. Stegun (eds.), \emph{Handbook of Mathematical Functions}, Nat. Bur. Standards Appl. Math. Ser.~55, Washington, 1964. \bibitem{Adlaj} S.~Adlaj, \emph{An eloquent formula for the perimeter of an ellipse}, Notices Amer. Math. Soc. \textbf{59} (2012), no.~8, 1094--1099. \doi{10.1090/noti879} \bibitem{AlmkvistBerndt} G.~Almkvist and B.~C. Berndt, \emph{Gauss, Landen, Ramanujan, the arithmetic-geometric mean, ellipses, $\pi$, and the Ladies Diary}, Amer. Math. Monthly \textbf{95} (1988), no.~7, 585--608. \doi{10.2307/2323302} \bibitem{AyalaRaggi2025} S.~E. Ayala-Raggi and M.~Rend\'on-Mar\'in, \emph{Is simplicity still possible for a more accurate approximation to the perimeter of the ellipse? or, Using the exponential function to further improve the second Ramanujan's approximation}, preprint \href{https://arxiv.org/abs/2510.16191}{arXiv:2510.16191}, 2025. \bibitem{ELIP} S.~E. Ayala-Raggi and M.~Rend\'on-Mar\'in, \emph{Approximating the ellipse perimeter by ``bending the line'': the ELIP closed-form family}, preprint \href{https://arxiv.org/abs/2610.28689}{arXiv:2610.28689}, 2026. \bibitem{BakerGravesMorris} G.~A. Baker, Jr. and P.~Graves-Morris, \emph{Pad\'e Approximants}, 2nd ed., Encyclopedia Math. Appl.~59, Cambridge University Press, Cambridge, 1996. \bibitem{BPS} R.~W. Barnard, K.~Pearce and L.~Schovanec, \emph{Inequalities for the perimeter of an ellipse}, J. Math. Anal. Appl. \textbf{260} (2001), no.~2, 295--306. \doi{10.1006/jmaa.2000.7128} \bibitem{BorweinBorwein} J.~M. Borwein and P.~B. Borwein, \emph{Pi and the AGM: A Study in Analytic Number Theory and Computational Complexity}, Wiley, New York, 1987. \bibitem{Brent1976} R.~P. Brent, \emph{Fast multiple-precision evaluation of elementary functions}, J. ACM \textbf{23} (1976), no.~2, 242--251. \doi{10.1145/321941.321944} \bibitem{Carlson1995} B.~C. Carlson, \emph{Numerical computation of real or complex elliptic integrals}, Numer. Algorithms \textbf{10} (1995), no.~1, 13--26. \doi{10.1007/BF02198293} \bibitem{DLMF} B.~C. Carlson, \emph{Elliptic integrals}, Chapter~19 of the \emph{NIST Digital Library of Mathematical Functions}, \url{https://dlmf.nist.gov/19}. \bibitem{ChowlaSelberg} S.~Chowla and A.~Selberg, \emph{On Epstein's zeta-function}, J. Reine Angew. Math. \textbf{227} (1967), 86--110. \doi{10.1515/crll.1967.227.86} \bibitem{Cody1965} W.~J. Cody, \emph{Chebyshev approximations for the complete elliptic integrals $K$ and $E$}, Math. Comp. \textbf{19} (1965), no.~89, 105--112; Corrigendum, ibid. \textbf{20} (1966), no.~93, 207. \doi{10.1090/S0025-5718-1965-0171370-4} \bibitem{Fog} A.~Fog, \emph{Instruction tables: Lists of instruction latencies, throughputs and micro-operation breakdowns for Intel, AMD and VIA CPUs}, Technical University of Denmark, \url{https://www.agner.org/optimize/}. \bibitem{Fukushima2009} T.~Fukushima, \emph{Fast computation of complete elliptic integrals and Jacobian elliptic functions}, Celest. Mech. Dyn. Astron. \textbf{105} (2009), 305--328. \doi{10.1007/s10569-009-9228-z} \bibitem{Fukushima2011} T.~Fukushima, \emph{Precise and fast computation of the general complete elliptic integral of the second kind}, Math. Comp. \textbf{80} (2011), no.~275, 1725--1743. \doi{10.1090/S0025-5718-2011-02455-5} \bibitem{Fukushima2015} T.~Fukushima, \emph{Precise and fast computation of complete elliptic integrals by piecewise minimax rational function approximation}, J. Comput. Appl. Math. \textbf{282} (2015), 71--76. \doi{10.1016/j.cam.2014.12.038} \bibitem{Hastings} C.~Hastings, Jr., \emph{Approximations for Digital Computers}, Princeton University Press, Princeton, 1955. \bibitem{IEEE754} \emph{IEEE Standard for Floating-Point Arithmetic}, IEEE Std 754-2019, 2019. \doi{10.1109/IEEESTD.2019.8766229} \bibitem{Ivory1798} J.~Ivory, \emph{A new series for the rectification of the ellipsis; together with some observations on the evolution of the formula $(a^2+b^2-2ab\cos\theta)^n$}, Trans. Roy. Soc. Edinburgh \textbf{4} (1798), 177--190. \doi{10.1017/S0080456800030817} \bibitem{Kaluza} Th.~Kaluza, \emph{\"Uber die Koeffizienten reziproker Potenzreihen}, Math. Z. \textbf{28} (1928), 161--170. \doi{10.1007/BF01181155} \bibitem{Kummer1836} E.~E. Kummer, \emph{\"Uber die hypergeometrische Reihe}, J. Reine Angew. Math. \textbf{15} (1836), 39--83 and 127--172. \doi{10.1515/crll.1836.15.39}, \doi{10.1515/crll.1836.15.127} \bibitem{MoscatoCiezak} P.~Moscato and A.~Ciezak, \emph{A new approximation for the perimeter of an ellipse}, Algorithms \textbf{17} (2024), no.~10, 464. \doi{10.3390/a17100464} \bibitem{Powell} M.~J.~D. Powell, \emph{Approximation Theory and Methods}, Cambridge University Press, Cambridge, 1981. \bibitem{Ramanujan1914} S.~Ramanujan, \emph{Modular equations and approximations to $\pi$}, Quart. J. Pure Appl. Math. \textbf{45} (1914), 350--372. \bibitem{Salamin} E.~Salamin, \emph{Computation of $\pi$ using arithmetic-geometric mean}, Math. Comp. \textbf{30} (1976), no.~135, 565--570. \doi{10.2307/2005327} \bibitem{Shankar} U.~Shankar, \emph{Perimeter of an ellipse: understanding Ramanujan's approximation}, preprint \href{https://arxiv.org/abs/2603.03373}{arXiv:2603.03373}, 2026. \bibitem{StandupMaths} M.~Parker (Stand-up Maths), \emph{Why is there no equation for the perimeter of an ellipse\textinterrobang}, YouTube video, 5 September 2020, \url{https://www.youtube.com/watch?v=5nW3nJhBHL0}. \bibitem{Sykora} S.~S\'ykora, \emph{Approximations of ellipse perimeters and of the complete elliptic integral $E(x)$: review of known formulae}, Stan's Library, Vol.~I, 2005. \doi{10.3247/SL1Math05.004} \bibitem{Sykora2007} S.~S\'ykora, \emph{Advances in approximations of ellipse perimeters and of the complete elliptic integral}, Stan's Library, Vol.~II, 2007. \bibitem{Villarino} M.~B. Villarino, \emph{Ramanujan's perimeter of an ellipse}, preprint \href{https://arxiv.org/abs/math/0506384}{arXiv:math/0506384}, 2005. \end{thebibliography} \appendix \section{Proof of Proposition~\ref{prop:conv}}\label{app:proof} By homogeneity we may assume $a=1$. Then $t=b\in[0,1]$ and $k=\sqrt{1-t^2}$, and we write $\widetilde E(t)=E(k)=P/4$ and $\widetilde K(t)=K(k)=\pi/(2M(1,t))$; note that $1\le\widetilde E\le\pi/2$. Let $F_N=P_N/4$, let $\widehat K_N$ be the estimate of $K$, and let $G_{N,n}=\widehat K_N\mathcal P_n+\mathcal Q_n=P^{\mathrm L}_{N,n}/4$ and $A=A_{N,n}/4$. \emph{Part~(a).} The AGM quantities $a_j$ and $b_j$ are continuous functions of $t\in[0,1]$, and $a_{j+1}\ge a_j/2$ gives $a_N+b_N\ge a_N\ge2^{-N}>0$. Hence $\widehat K_N$ and $G_{N,n}$ are continuous on $[0,1]$, and $F_N$ is continuous on $(0,1]$. The two branches agree at $t=t_s$ by the choice of $\gamma$, so $A$ is continuous. At $t=0$ we have $\mathcal P_n(0)=0$ and $\mathcal Q_n(0)=1$, so $A(0)=1$, that is, $P=4a$. At $t=1$ all $a_j$ and $b_j$ equal $1$ and $c_1=0$, so $F_N(1)=\pi/2$, that is, $P=2\pi a$. \emph{Step 1: the AGM.} For $00$ the convergence is therefore uniform, and eventually doubly exponential: once $a_j-b_j<8\delta$, the quantity $(a_j-b_j)/(8\delta)$ is at least squared in every step. Since $2M\ge2\delta$ and $|a_N+b_N-2M|\le a_N-b_N$, both estimates of $K$ converge to $\widetilde K=\pi/(2M)$, and $F_N$ converges to $\widetilde E$, because the tail $\sum_{j>N}2^{j-1}c_j^2$ of~\eqref{eq:AGM}, with $c_j=(a_{j-1}-b_{j-1})/2$, tends to zero; all of this holds uniformly for $\delta\le t\le1$. Moreover, $a_N+b_N\ge2M$ gives $0\le\pi/(a_N+b_N)\le\widetilde K$, and $3a_N^2+10a_Nb_N+3b_N^2\ge3(a_N+b_N)^2$ shows that the estimate~\eqref{eq:Kref} lies between $0$ and $\frac43\widetilde K$. For both estimates, therefore, \begin{equation}\label{eq:Kbound} |\widehat K_N(t)-\widetilde K(t)|\le\widetilde K(t)\qquad(0N$, is $\sum_{i0$ on $[0,1)$, this gives $\sum_{n=1}^{N}\beta_nm^n<1$ for $0\le m<1$, and letting $m\to1$ and then $N\to\infty$ gives $\sum_{n\ge1}\beta_n\le1$. In particular the series of $1/f$ converges absolutely for $|m|\le1$ and represents $1/f$ for $|m|<1$. The coefficients of $g$ are absolutely summable as well, with sum of absolute values $2-2/\pi$. Since absolutely summable sequences are closed under the Cauchy product, the coefficients of $\mathcal P=1-g\cdot(1/f)$ are absolutely summable too. Write $\mathcal P(t)=\sum_{j\ge1}p_jt^{2j}$ and $\mathcal Q(t)=\sum_{j\ge0}q_jt^{2j}$, and let $C=\sum_{j\ge1}|p_j|$, $\tau^{\mathcal P}_n=\sum_{j>n}|p_j|$ and $\tau^{\mathcal Q}_n=\sum_{j>n}|q_j|$. Then the series converge uniformly on $[0,1]$, $\tau^{\mathcal P}_n,\tau^{\mathcal Q}_n\to0$, and for $0\le t\le1$ \begin{equation}\label{eq:tails} |\mathcal P(t)-\mathcal P_n(t)|\le\tau^{\mathcal P}_n\,t^{2n+2},\qquad|\mathcal Q(t)-\mathcal Q_n(t)|\le\tau^{\mathcal Q}_n,\qquad|\mathcal P_n(t)|\le C\,t^2 . \end{equation} By continuity, Legendre's relation $\widetilde E=\widetilde K\mathcal P+\mathcal Q$ holds for $00$, choose $\delta$ with $2C\eta(\delta)<\varepsilon/4$; then $n_0$ with $2(\kappa\tau^{\mathcal P}_n+\tau^{\mathcal Q}_n)<\varepsilon/4$ for all $n\ge n_0$; and finally $N_0$ with $\varphi_N<\varepsilon/4$ and $2C\omega_N(\delta)<\varepsilon/4$ for all $N\ge N_0$, using Step~1 with $\delta$ and with $t_s$. Then $|A-\widetilde E|<\varepsilon$ on $[0,1]$, and since $\widetilde E\ge1$, also $|A/\widetilde E-1|<\varepsilon$. This proves part~(c). \qed \section{Constants of the real-coefficient formulas}\label{app:const} All formulas have the form~\eqref{eq:nested}, $P\approx\pi(a+b)\bigl(1+3h/(q+\sqrt{r_1+\sqrt{\dots+\sqrt{Q(h)}}})\bigr)$ with $Q(h)=\sum_k Q_kh^k$. The constants are given to between $11$ and $16$ significant digits, mostly $15$ or $16$. The number of digits actually needed is discussed in Section~\ref{sec:tform}: in powers of $h$ the quadruple-nested formulas need up to $14$ of them, in powers of $\sigma$ at most $11$. The very small errors near the circle reported for $B_3$, $B_4$, $S_3$ and $S_4$ require more digits of the matched coefficients (Section~\ref{sec:numerics}). Tables~\ref{tab:c3} and~\ref{tab:c4} give the coefficients $Q_k$ of the innermost polynomial in powers of $h$, and Table~\ref{tab:tc} gives the coefficients $g_k$ of the same polynomial in powers of $\sigma=1-h=4ab/(a+b)^2$, which should be used in floating-point evaluation. The two sets are separate roundings of the same polynomials. Since $g_0=Q(1)$ is much smaller than the $Q_k$ for the deeper formulas, the $g_k$ computed from the rounded $Q_k$ differ from those in Table~\ref{tab:tc} in the last digits, and for $B_4$ and $C_4$ already in the ninth significant digit of $g_0$ (relative differences $7\times10^{-10}$ and $6\times10^{-8}$); the coefficients in powers of $\sigma$ should therefore be taken from Table~\ref{tab:tc}. The double-nested formulas $B_2$ and $S_2$ are the members $c^*=1.6083816339$ and $c=\frac32(\sqrt{17}-3)$ of the family~\eqref{eq:family}. The formula $C_2$ has $q=10.0090857908803$, $r_1=0.6128422340926082$ and $Q(h)=11.21355851685472-19.93701722530456h+8.831504042401445h^2$, or in powers of $\sigma=1-h$, $Q=0.108045333951605+2.27400914050167\sigma+8.831504042401445\sigma^2$. \begin{table}[htbp] \centering \scriptsize \caption{Constants of the real-coefficient triple-nested formulas (innermost polynomial in powers of $h$).} \label{tab:c3} \begin{tabular}{@{}lrrr@{}} \toprule & $B_3$ & $S_3$ & $C_3$\\ \midrule $q$ & $10.29433900484506$ & $9.901118545551911$ & $7.019352275714195$\\ $r_1$ & $-3.341141176193871$ & $-15.32081840331176$ & $13.80578502232042$\\ $r_2$ & $13.28678013650547$ & $245.7056780801806$ & $2.351193196498491$\\ $Q_0$ & $664.6588071841899$ & $20567.63325898943$ & $14080.40649434002$\\ $Q_1$ & $-1649.12127158747$ & $-35626.48944268275$ & $-38989.58516019706$\\ $Q_2$ & $1413.808679491932$ & $17956.04055956124$ & $35812.57137464874$\\ $Q_3$ & $-486.7455903150188$ & $-2257.517954692982$ & $-10847.28729948503$\\ $Q_4$ & $58.91906584057077$ & $47.95933656661023$ & $-54.74049119699177$\\ \bottomrule \end{tabular} \end{table} \begin{table}[htbp] \centering \scriptsize \caption{Constants of the quadruple-nested formulas (innermost polynomial in powers of $h$).} \label{tab:c4} \begin{tabular}{@{}lrrr@{}} \toprule & $B_4$ & $S_4$ & $C_4$\\ \midrule $q$ & $10.85467560067979$ & $6.398229749134604$ & $10.86740281549944$\\ $r_1$ & $-14.99617978628396$ & $7.724819030181588$ & $-12.95175980740153$\\ $r_2$ & $217.4248221484751$ & $81.68388870382054$ & $165.6816448386081$\\ $r_3$ & $60.69690320044219$ & $3430.148049356863$ & $5.370651452451673$\\ $Q_0$ & $5262043.703342058$ & $50595750312.388$ & $1847512.118262919$\\ $Q_1$ & $-24948584.87807319$ & $-170923436563.0533$ & $-9715172.366338652$\\ $Q_2$ & $48781397.45217162$ & $225198491690.7474$ & $21117013.89003979$\\ $Q_3$ & $-50145829.27576912$ & $-145074484755.0125$ & $-24214491.83091987$\\ $Q_4$ & $28369626.76334429$ & $46568798796.73117$ & $15460171.06217302$\\ $Q_5$ & $-8303793.301070271$ & $-6601332084.471917$ & $-5410777.648048259$\\ $Q_6$ & $1070262.324933209$ & $264381866.3523564$ & $1152269.946706327$\\ $Q_7$ & $-122188.4721802651$ & $1598629.223142381$ & $-316369.8247714597$\\ $Q_8$ & $37070.28010040734$ & $62156.11535253739$ & $79844.77403337315$\\ \bottomrule \end{tabular} \end{table} \begin{table}[htbp] \centering \scriptsize \caption{Coefficients of the innermost polynomial in powers of $\sigma=1-h=4ab/(a+b)^2$, $Q=\sum_k g_k\sigma^k$, for the real-coefficient triple- and quadruple-nested formulas; the outer constants $q$ and $r_j$ are those of Tables~\ref{tab:c3} and~\ref{tab:c4}.} \label{tab:tc} \begin{tabular}{@{}lrrr@{}} \toprule & $B_3$ & $S_3$ & $C_3$\\ \midrule $g_0$ & $1.519690614203828$ & $687.6257577415486$ & $1.36491810967023$\\ $g_1$ & $46.06442018637908$ & $6295.124841372778$ & $125.2662741426501$\\ $g_2$ & $307.0863035903005$ & $11471.24271488195$ & $2942.26652901169$\\ $g_3$ & $251.0693269527357$ & $2065.680608426541$ & $11066.249264273$\\ $g_4$ & $58.91906584057077$ & $47.95933656661023$ & $-54.74049119699177$\\ \bottomrule \end{tabular} \par\medskip \begin{tabular}{@{}lrrr@{}} \toprule & $B_4$ & $S_4$ & $C_4$\\ \midrule $g_0$ & $4.596798741646269$ & $29830049.01970314$ & $0.12113718121$\\ $g_1$ & $920.3678708487985$ & $883393830.4320084$ & $34.97146318858$\\ $g_2$ & $49681.99525125551$ & $7375548941.57889$ & $2724.84316439066$\\ $g_3$ & $500669.5751169605$ & $19465540320.49015$ & $37821.6497160375$\\ $g_4$ & $1222918.212710306$ & $17588169320.54159$ & $206522.3378616636$\\ $g_5$ & $2372241.581633772$ & $4977988930.212046$ & $669616.9421420527$\\ $g_6$ & $1252910.862482759$ & $277312642.1442241$ & $1173334.846240557$\\ $g_7$ & $-174373.7686229936$ & $-2095878.14596268$ & $-322388.3674955255$\\ $g_8$ & $37070.28010040734$ & $62156.11535253739$ & $79844.77403337315$\\ \bottomrule \end{tabular} \end{table} \end{document}