2atan (example 3.5)

Percentage Accurate: 76.6% → 99.3%
Time: 7.9s
Alternatives: 5
Speedup: 1.9×

Specification

?
\[\begin{array}{l} \\ \tan^{-1} \left(N + 1\right) - \tan^{-1} N \end{array} \]
(FPCore (N) :precision binary64 (- (atan (+ N 1.0)) (atan N)))
double code(double N) {
	return atan((N + 1.0)) - atan(N);
}
real(8) function code(n)
    real(8), intent (in) :: n
    code = atan((n + 1.0d0)) - atan(n)
end function
public static double code(double N) {
	return Math.atan((N + 1.0)) - Math.atan(N);
}
def code(N):
	return math.atan((N + 1.0)) - math.atan(N)
function code(N)
	return Float64(atan(Float64(N + 1.0)) - atan(N))
end
function tmp = code(N)
	tmp = atan((N + 1.0)) - atan(N);
end
code[N_] := N[(N[ArcTan[N[(N + 1.0), $MachinePrecision]], $MachinePrecision] - N[ArcTan[N], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1} \left(N + 1\right) - \tan^{-1} N
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 76.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \tan^{-1} \left(N + 1\right) - \tan^{-1} N \end{array} \]
(FPCore (N) :precision binary64 (- (atan (+ N 1.0)) (atan N)))
double code(double N) {
	return atan((N + 1.0)) - atan(N);
}
real(8) function code(n)
    real(8), intent (in) :: n
    code = atan((n + 1.0d0)) - atan(n)
end function
public static double code(double N) {
	return Math.atan((N + 1.0)) - Math.atan(N);
}
def code(N):
	return math.atan((N + 1.0)) - math.atan(N)
function code(N)
	return Float64(atan(Float64(N + 1.0)) - atan(N))
end
function tmp = code(N)
	tmp = atan((N + 1.0)) - atan(N);
end
code[N_] := N[(N[ArcTan[N[(N + 1.0), $MachinePrecision]], $MachinePrecision] - N[ArcTan[N], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1} \left(N + 1\right) - \tan^{-1} N
\end{array}

Alternative 1: 99.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)} \end{array} \]
(FPCore (N) :precision binary64 (atan2 1.0 (+ 1.0 (fma N N N))))
double code(double N) {
	return atan2(1.0, (1.0 + fma(N, N, N)));
}
function code(N)
	return atan(1.0, Float64(1.0 + fma(N, N, N)))
end
code[N_] := N[ArcTan[1.0 / N[(1.0 + N[(N * N + N), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}
\end{array}
Derivation
  1. Initial program 78.1%

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
  2. Step-by-step derivation
    1. diff-atan78.1%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
    2. associate--l+78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
    3. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
    4. *-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
    5. fma-def78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  3. Applied egg-rr78.1%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  4. Step-by-step derivation
    1. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    2. associate-+l-99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    3. +-inverses99.0%

      \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    4. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    5. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
  5. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
  6. Taylor expanded in N around -inf 99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
  7. Step-by-step derivation
    1. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
    2. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
    3. *-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
    4. cancel-sign-sub-inv99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
    5. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
    6. *-lft-identity99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
    7. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
    8. distribute-lft1-in99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
    9. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
  8. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
  9. Final simplification99.0%

    \[\leadsto \tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)} \]

Alternative 2: 97.0% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;N \leq -1 \lor \neg \left(N \leq 1\right):\\ \;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{1}{1}\\ \end{array} \end{array} \]
(FPCore (N)
 :precision binary64
 (if (or (<= N -1.0) (not (<= N 1.0))) (atan2 1.0 (* N N)) (atan2 1.0 1.0)))
double code(double N) {
	double tmp;
	if ((N <= -1.0) || !(N <= 1.0)) {
		tmp = atan2(1.0, (N * N));
	} else {
		tmp = atan2(1.0, 1.0);
	}
	return tmp;
}
real(8) function code(n)
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((n <= (-1.0d0)) .or. (.not. (n <= 1.0d0))) then
        tmp = atan2(1.0d0, (n * n))
    else
        tmp = atan2(1.0d0, 1.0d0)
    end if
    code = tmp
end function
public static double code(double N) {
	double tmp;
	if ((N <= -1.0) || !(N <= 1.0)) {
		tmp = Math.atan2(1.0, (N * N));
	} else {
		tmp = Math.atan2(1.0, 1.0);
	}
	return tmp;
}
def code(N):
	tmp = 0
	if (N <= -1.0) or not (N <= 1.0):
		tmp = math.atan2(1.0, (N * N))
	else:
		tmp = math.atan2(1.0, 1.0)
	return tmp
function code(N)
	tmp = 0.0
	if ((N <= -1.0) || !(N <= 1.0))
		tmp = atan(1.0, Float64(N * N));
	else
		tmp = atan(1.0, 1.0);
	end
	return tmp
end
function tmp_2 = code(N)
	tmp = 0.0;
	if ((N <= -1.0) || ~((N <= 1.0)))
		tmp = atan2(1.0, (N * N));
	else
		tmp = atan2(1.0, 1.0);
	end
	tmp_2 = tmp;
end
code[N_] := If[Or[LessEqual[N, -1.0], N[Not[LessEqual[N, 1.0]], $MachinePrecision]], N[ArcTan[1.0 / N[(N * N), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0 / 1.0], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;N \leq -1 \lor \neg \left(N \leq 1\right):\\
\;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{1}{1}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if N < -1 or 1 < N

    1. Initial program 49.5%

      \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
    2. Step-by-step derivation
      1. diff-atan49.5%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
      2. associate--l+49.5%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
      3. +-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
      4. *-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
      5. fma-def49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    3. Applied egg-rr49.5%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    4. Step-by-step derivation
      1. +-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      2. associate-+l-97.7%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      3. +-inverses97.7%

        \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      4. metadata-eval97.7%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      5. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
    5. Simplified97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
    6. Taylor expanded in N around -inf 97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
    7. Step-by-step derivation
      1. fma-udef97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
      2. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
      3. *-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
      4. cancel-sign-sub-inv97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
      5. metadata-eval97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
      6. *-lft-identity97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
      7. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
      8. distribute-lft1-in97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
      9. fma-udef97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
    8. Simplified97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
    9. Taylor expanded in N around inf 97.7%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{{N}^{2}}} \]
    10. Step-by-step derivation
      1. unpow297.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot N}} \]
    11. Simplified97.7%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot N}} \]

    if -1 < N < 1

    1. Initial program 100.0%

      \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
    2. Step-by-step derivation
      1. diff-atan100.0%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
      2. associate--l+100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
      3. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
      4. *-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
      5. fma-def100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    4. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      2. associate-+l-100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      3. +-inverses100.0%

        \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      4. metadata-eval100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      5. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
    6. Taylor expanded in N around -inf 100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
    7. Step-by-step derivation
      1. fma-udef100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
      2. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
      3. *-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
      4. cancel-sign-sub-inv100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
      5. metadata-eval100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
      6. *-lft-identity100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
      7. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
      8. distribute-lft1-in100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
      9. fma-udef100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
    9. Taylor expanded in N around 0 97.2%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification97.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;N \leq -1 \lor \neg \left(N \leq 1\right):\\ \;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{1}{1}\\ \end{array} \]

Alternative 3: 97.5% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;N \leq -0.62 \lor \neg \left(N \leq 1.65\right):\\ \;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{1}{1 + N}\\ \end{array} \end{array} \]
(FPCore (N)
 :precision binary64
 (if (or (<= N -0.62) (not (<= N 1.65)))
   (atan2 1.0 (* N N))
   (atan2 1.0 (+ 1.0 N))))
double code(double N) {
	double tmp;
	if ((N <= -0.62) || !(N <= 1.65)) {
		tmp = atan2(1.0, (N * N));
	} else {
		tmp = atan2(1.0, (1.0 + N));
	}
	return tmp;
}
real(8) function code(n)
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((n <= (-0.62d0)) .or. (.not. (n <= 1.65d0))) then
        tmp = atan2(1.0d0, (n * n))
    else
        tmp = atan2(1.0d0, (1.0d0 + n))
    end if
    code = tmp
end function
public static double code(double N) {
	double tmp;
	if ((N <= -0.62) || !(N <= 1.65)) {
		tmp = Math.atan2(1.0, (N * N));
	} else {
		tmp = Math.atan2(1.0, (1.0 + N));
	}
	return tmp;
}
def code(N):
	tmp = 0
	if (N <= -0.62) or not (N <= 1.65):
		tmp = math.atan2(1.0, (N * N))
	else:
		tmp = math.atan2(1.0, (1.0 + N))
	return tmp
function code(N)
	tmp = 0.0
	if ((N <= -0.62) || !(N <= 1.65))
		tmp = atan(1.0, Float64(N * N));
	else
		tmp = atan(1.0, Float64(1.0 + N));
	end
	return tmp
end
function tmp_2 = code(N)
	tmp = 0.0;
	if ((N <= -0.62) || ~((N <= 1.65)))
		tmp = atan2(1.0, (N * N));
	else
		tmp = atan2(1.0, (1.0 + N));
	end
	tmp_2 = tmp;
end
code[N_] := If[Or[LessEqual[N, -0.62], N[Not[LessEqual[N, 1.65]], $MachinePrecision]], N[ArcTan[1.0 / N[(N * N), $MachinePrecision]], $MachinePrecision], N[ArcTan[1.0 / N[(1.0 + N), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;N \leq -0.62 \lor \neg \left(N \leq 1.65\right):\\
\;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{1}{1 + N}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if N < -0.619999999999999996 or 1.6499999999999999 < N

    1. Initial program 49.5%

      \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
    2. Step-by-step derivation
      1. diff-atan49.5%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
      2. associate--l+49.5%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
      3. +-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
      4. *-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
      5. fma-def49.5%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    3. Applied egg-rr49.5%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    4. Step-by-step derivation
      1. +-commutative49.5%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      2. associate-+l-97.7%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      3. +-inverses97.7%

        \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      4. metadata-eval97.7%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      5. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
    5. Simplified97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
    6. Taylor expanded in N around -inf 97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
    7. Step-by-step derivation
      1. fma-udef97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
      2. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
      3. *-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
      4. cancel-sign-sub-inv97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
      5. metadata-eval97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
      6. *-lft-identity97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
      7. +-commutative97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
      8. distribute-lft1-in97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
      9. fma-udef97.7%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
    8. Simplified97.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
    9. Taylor expanded in N around inf 97.7%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{{N}^{2}}} \]
    10. Step-by-step derivation
      1. unpow297.7%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot N}} \]
    11. Simplified97.7%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot N}} \]

    if -0.619999999999999996 < N < 1.6499999999999999

    1. Initial program 100.0%

      \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
    2. Step-by-step derivation
      1. diff-atan100.0%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
      2. associate--l+100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
      3. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
      4. *-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
      5. fma-def100.0%

        \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    3. Applied egg-rr100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
    4. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      2. associate-+l-100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      3. +-inverses100.0%

        \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      4. metadata-eval100.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
      5. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
    5. Simplified100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
    6. Taylor expanded in N around -inf 100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
    7. Step-by-step derivation
      1. fma-udef100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
      2. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
      3. *-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
      4. cancel-sign-sub-inv100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
      5. metadata-eval100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
      6. *-lft-identity100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
      7. +-commutative100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
      8. distribute-lft1-in100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
      9. fma-udef100.0%

        \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
    8. Simplified100.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
    9. Taylor expanded in N around 0 98.6%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;N \leq -0.62 \lor \neg \left(N \leq 1.65\right):\\ \;\;\;\;\tan^{-1}_* \frac{1}{N \cdot N}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{1}{1 + N}\\ \end{array} \]

Alternative 4: 99.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{1}{N + \left(1 + N \cdot N\right)} \end{array} \]
(FPCore (N) :precision binary64 (atan2 1.0 (+ N (+ 1.0 (* N N)))))
double code(double N) {
	return atan2(1.0, (N + (1.0 + (N * N))));
}
real(8) function code(n)
    real(8), intent (in) :: n
    code = atan2(1.0d0, (n + (1.0d0 + (n * n))))
end function
public static double code(double N) {
	return Math.atan2(1.0, (N + (1.0 + (N * N))));
}
def code(N):
	return math.atan2(1.0, (N + (1.0 + (N * N))))
function code(N)
	return atan(1.0, Float64(N + Float64(1.0 + Float64(N * N))))
end
function tmp = code(N)
	tmp = atan2(1.0, (N + (1.0 + (N * N))));
end
code[N_] := N[ArcTan[1.0 / N[(N + N[(1.0 + N[(N * N), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{1}{N + \left(1 + N \cdot N\right)}
\end{array}
Derivation
  1. Initial program 78.1%

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
  2. Step-by-step derivation
    1. diff-atan78.1%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
    2. associate--l+78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
    3. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
    4. *-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
    5. fma-def78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  3. Applied egg-rr78.1%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  4. Step-by-step derivation
    1. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    2. associate-+l-99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    3. +-inverses99.0%

      \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    4. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    5. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
  5. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
  6. Taylor expanded in N around -inf 99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
  7. Step-by-step derivation
    1. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
    2. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
    3. *-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
    4. cancel-sign-sub-inv99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
    5. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
    6. *-lft-identity99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
    7. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
    8. distribute-lft1-in99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
    9. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
  8. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
  9. Step-by-step derivation
    1. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\mathsf{fma}\left(N, N, N\right) + 1}} \]
    2. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(N \cdot N + N\right)} + 1} \]
    3. *-un-lft-identity99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\left(N \cdot N + \color{blue}{1 \cdot N}\right) + 1} \]
    4. distribute-rgt-in99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
    5. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{N \cdot \color{blue}{\left(1 + N\right)} + 1} \]
    6. add-sqr-sqrt52.1%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(\sqrt{N} \cdot \sqrt{N}\right)} \cdot \left(1 + N\right) + 1} \]
    7. associate-*l*52.1%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\sqrt{N} \cdot \left(\sqrt{N} \cdot \left(1 + N\right)\right)} + 1} \]
    8. fma-def52.1%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\mathsf{fma}\left(\sqrt{N}, \sqrt{N} \cdot \left(1 + N\right), 1\right)}} \]
  10. Applied egg-rr52.1%

    \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\mathsf{fma}\left(\sqrt{N}, \sqrt{N} \cdot \left(1 + N\right), 1\right)}} \]
  11. Step-by-step derivation
    1. fma-udef52.1%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\sqrt{N} \cdot \left(\sqrt{N} \cdot \left(1 + N\right)\right) + 1}} \]
    2. associate-*r*52.1%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(\sqrt{N} \cdot \sqrt{N}\right) \cdot \left(1 + N\right)} + 1} \]
    3. add-sqr-sqrt99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N} \cdot \left(1 + N\right) + 1} \]
    4. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{N \cdot \color{blue}{\left(N + 1\right)} + 1} \]
    5. distribute-rgt-out99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(N \cdot N + 1 \cdot N\right)} + 1} \]
    6. *-un-lft-identity99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\left(N \cdot N + \color{blue}{N}\right) + 1} \]
    7. associate-+r+99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot N + \left(N + 1\right)}} \]
    8. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{N \cdot N + \color{blue}{\left(1 + N\right)}} \]
    9. associate-+r+99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(N \cdot N + 1\right) + N}} \]
  12. Applied egg-rr99.0%

    \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{\left(N \cdot N + 1\right) + N}} \]
  13. Final simplification99.0%

    \[\leadsto \tan^{-1}_* \frac{1}{N + \left(1 + N \cdot N\right)} \]

Alternative 5: 50.9% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{1}{1} \end{array} \]
(FPCore (N) :precision binary64 (atan2 1.0 1.0))
double code(double N) {
	return atan2(1.0, 1.0);
}
real(8) function code(n)
    real(8), intent (in) :: n
    code = atan2(1.0d0, 1.0d0)
end function
public static double code(double N) {
	return Math.atan2(1.0, 1.0);
}
def code(N):
	return math.atan2(1.0, 1.0)
function code(N)
	return atan(1.0, 1.0)
end
function tmp = code(N)
	tmp = atan2(1.0, 1.0);
end
code[N_] := N[ArcTan[1.0 / 1.0], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{1}{1}
\end{array}
Derivation
  1. Initial program 78.1%

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
  2. Step-by-step derivation
    1. diff-atan78.1%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\left(N + 1\right) - N}{1 + \left(N + 1\right) \cdot N}} \]
    2. associate--l+78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{N + \left(1 - N\right)}}{1 + \left(N + 1\right) \cdot N} \]
    3. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\left(N + 1\right) \cdot N + 1}} \]
    4. *-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{N \cdot \left(N + 1\right)} + 1} \]
    5. fma-def78.1%

      \[\leadsto \tan^{-1}_* \frac{N + \left(1 - N\right)}{\color{blue}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  3. Applied egg-rr78.1%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{N + \left(1 - N\right)}{\mathsf{fma}\left(N, N + 1, 1\right)}} \]
  4. Step-by-step derivation
    1. +-commutative78.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(1 - N\right) + N}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    2. associate-+l-99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1 - \left(N - N\right)}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    3. +-inverses99.0%

      \[\leadsto \tan^{-1}_* \frac{1 - \color{blue}{0}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    4. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{1}}{\mathsf{fma}\left(N, N + 1, 1\right)} \]
    5. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, \color{blue}{1 + N}, 1\right)} \]
  5. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 + N, 1\right)}} \]
  6. Taylor expanded in N around -inf 99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{\mathsf{fma}\left(N, 1 - -1 \cdot N, 1\right)}} \]
  7. Step-by-step derivation
    1. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{N \cdot \left(1 - -1 \cdot N\right) + 1}} \]
    2. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1 + N \cdot \left(1 - -1 \cdot N\right)}} \]
    3. *-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 - -1 \cdot N\right) \cdot N}} \]
    4. cancel-sign-sub-inv99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(1 + \left(--1\right) \cdot N\right)} \cdot N} \]
    5. metadata-eval99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{1} \cdot N\right) \cdot N} \]
    6. *-lft-identity99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \left(1 + \color{blue}{N}\right) \cdot N} \]
    7. +-commutative99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N + 1\right)} \cdot N} \]
    8. distribute-lft1-in99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\left(N \cdot N + N\right)}} \]
    9. fma-udef99.0%

      \[\leadsto \tan^{-1}_* \frac{1}{1 + \color{blue}{\mathsf{fma}\left(N, N, N\right)}} \]
  8. Simplified99.0%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{1}{1 + \mathsf{fma}\left(N, N, N\right)}} \]
  9. Taylor expanded in N around 0 56.8%

    \[\leadsto \tan^{-1}_* \frac{1}{\color{blue}{1}} \]
  10. Final simplification56.8%

    \[\leadsto \tan^{-1}_* \frac{1}{1} \]

Developer target: 99.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right) \end{array} \]
(FPCore (N) :precision binary64 (atan (/ 1.0 (+ 1.0 (* N (+ N 1.0))))))
double code(double N) {
	return atan((1.0 / (1.0 + (N * (N + 1.0)))));
}
real(8) function code(n)
    real(8), intent (in) :: n
    code = atan((1.0d0 / (1.0d0 + (n * (n + 1.0d0)))))
end function
public static double code(double N) {
	return Math.atan((1.0 / (1.0 + (N * (N + 1.0)))));
}
def code(N):
	return math.atan((1.0 / (1.0 + (N * (N + 1.0)))))
function code(N)
	return atan(Float64(1.0 / Float64(1.0 + Float64(N * Float64(N + 1.0)))))
end
function tmp = code(N)
	tmp = atan((1.0 / (1.0 + (N * (N + 1.0)))));
end
code[N_] := N[ArcTan[N[(1.0 / N[(1.0 + N[(N * N[(N + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right)
\end{array}

Reproduce

?
herbie shell --seed 2023277 
(FPCore (N)
  :name "2atan (example 3.5)"
  :precision binary64

  :herbie-target
  (atan (/ 1.0 (+ 1.0 (* N (+ N 1.0)))))

  (- (atan (+ N 1.0)) (atan N)))