?

Average Error: 14.9 → 14.9
Time: 9.5s
Precision: binary64
Cost: 147008

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.9
Target0.3
Herbie14.9
\[\tan^{-1} \left(\frac{1}{1 + N \cdot \left(N + 1\right)}\right) \]

Derivation?

  1. Initial program 14.9

    \[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]
  2. Applied egg-rr31.4

    \[\leadsto \color{blue}{\frac{\frac{1}{\tan^{-1} \left(N + 1\right) - \tan^{-1} N}}{\left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right) \cdot \left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right)} \cdot \left(\left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right) \cdot \left(\left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right) \cdot \left(\left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right) \cdot \left(\tan^{-1} \left(N + 1\right) - \tan^{-1} N\right)\right)\right)\right)} \]
  3. Applied egg-rr14.9

    \[\leadsto \color{blue}{\left(\tan^{-1} \left(1 + N\right) - \left(\tan^{-1} N - -1\right)\right) + 1} \]
  4. Applied egg-rr14.9

    \[\leadsto \left(\tan^{-1} \left(1 + N\right) - \color{blue}{\left(\left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)\right)\right) \cdot \frac{\frac{\frac{1}{1 + \tan^{-1} N}}{\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)}}{\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)}}\right) + 1 \]
  5. Applied egg-rr14.9

    \[\leadsto \left(\tan^{-1} \left(1 + N\right) - \left(\left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)\right)\right) \cdot \frac{\color{blue}{\frac{1}{\frac{\frac{1}{1 + \tan^{-1} N}}{\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)}} \cdot \left(\frac{\frac{1}{1 + \tan^{-1} N}}{\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)} \cdot \frac{\frac{1}{1 + \tan^{-1} N}}{\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)}\right)}}{\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(\left(1 + \tan^{-1} N\right) \cdot \left(1 + \tan^{-1} N\right)\right)\right)}\right) + 1 \]
  6. Final simplification14.9

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

Alternatives

Alternative 1
Error14.9
Cost13376
\[\left(\tan^{-1} \left(1 + N\right) - \left(\tan^{-1} N - -1\right)\right) + 1 \]
Alternative 2
Error14.9
Cost13376
\[2 - \left(\tan^{-1} N - \left(\tan^{-1} \left(1 + N\right) - 2\right)\right) \]
Alternative 3
Error14.9
Cost13120
\[\tan^{-1} \left(N + 1\right) - \tan^{-1} N \]

Error

Reproduce?

herbie shell --seed 2023077 
(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)))