?

Average Error: 0.3 → 0.3
Time: 7.5s
Precision: binary64
Cost: 104832

?

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

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Initial program 0.3

    \[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x} \]
  2. Applied egg-rr0.3

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{1 + \color{blue}{\frac{\frac{1}{\left|\tan x\right|} \cdot \left(1 \cdot \left|\tan x\right|\right) - \left(1 \cdot \left|\tan x\right|\right) \cdot \left(1 \cdot \left|\tan x\right|\right)}{\frac{1}{\left|\tan x\right|} \cdot \frac{1}{\left|\tan x\right|} - \frac{1}{\left|\tan x\right|} \cdot \left(1 \cdot \left|\tan x\right|\right)}}} \]
  3. Applied egg-rr0.3

    \[\leadsto \frac{1 - \tan x \cdot \tan x}{1 + \frac{\frac{1}{\left|\tan x\right|} \cdot \left(1 \cdot \left|\tan x\right|\right) - \color{blue}{\frac{\tan x \cdot \left(-\tan x\right)}{-1}}}{\frac{1}{\left|\tan x\right|} \cdot \frac{1}{\left|\tan x\right|} - \frac{1}{\left|\tan x\right|} \cdot \left(1 \cdot \left|\tan x\right|\right)}} \]
  4. Final simplification0.3

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

Alternatives

Alternative 1
Error0.3
Cost52416
\[\begin{array}{l} t_0 := {\left(\left|\tan x\right|\right)}^{2}\\ \frac{1 - \tan x \cdot \tan x}{1 + \frac{1 - t_0}{\frac{1}{t_0} - 1}} \end{array} \]
Alternative 2
Error0.3
Cost26304
\[\begin{array}{l} t_0 := \tan x \cdot \tan x\\ \frac{1 - t_0}{1 + t_0} \end{array} \]
Alternative 3
Error25.8
Cost20416
\[\frac{1 - \tan x \cdot \tan x}{1 + \frac{\tan x \cdot 1}{\frac{1}{x} + x \cdot -0.3333333333333333}} \]
Alternative 4
Error28.5
Cost13248
\[\frac{1}{1 + \tan x \cdot \tan x} \]
Alternative 5
Error28.7
Cost64
\[1 \]

Error

Reproduce?

herbie shell --seed 2023104 
(FPCore (x)
  :name "Trigonometry B"
  :precision binary64
  (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))