?

Average Error: 0.3 → 0.0
Time: 1.8min
Precision: binary64
Cost: 6592

?

\[\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x} \]
\[\cos \left(2 \cdot x\right) \]
(FPCore (x)
 :precision binary64
 (/ (- 1.0 (* (tan x) (tan x))) (+ 1.0 (* (tan x) (tan x)))))
(FPCore (x) :precision binary64 (cos (* 2.0 x)))
double code(double x) {
	return (1.0 - (tan(x) * tan(x))) / (1.0 + (tan(x) * tan(x)));
}
double code(double x) {
	return cos((2.0 * x));
}
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
    code = cos((2.0d0 * x))
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) {
	return Math.cos((2.0 * x));
}
def code(x):
	return (1.0 - (math.tan(x) * math.tan(x))) / (1.0 + (math.tan(x) * math.tan(x)))
def code(x):
	return math.cos((2.0 * x))
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)
	return cos(Float64(2.0 * x))
end
function tmp = code(x)
	tmp = (1.0 - (tan(x) * tan(x))) / (1.0 + (tan(x) * tan(x)));
end
function tmp = code(x)
	tmp = cos((2.0 * x));
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_] := N[Cos[N[(2.0 * x), $MachinePrecision]], $MachinePrecision]
\frac{1 - \tan x \cdot \tan x}{1 + \tan x \cdot \tan x}
\cos \left(2 \cdot x\right)

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. Simplified0.3

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\tan x, \tan x, -1\right)}{-1 - {\tan x}^{2}}} \]
    Proof
  3. Applied egg-rr0.3

    \[\leadsto \frac{\color{blue}{{\tan x}^{2} - 1}}{-1 - {\tan x}^{2}} \]
  4. Applied egg-rr0.4

    \[\leadsto \frac{\color{blue}{\frac{-\cos \left(x + x\right)}{{\cos x}^{2}}}}{-1 - {\tan x}^{2}} \]
  5. Applied egg-rr0.0

    \[\leadsto \color{blue}{\cos \left(x + x\right) \cdot \frac{1}{\frac{{\cos x}^{2}}{{\cos x}^{2}}}} \]
  6. Simplified0.0

    \[\leadsto \color{blue}{\cos \left(2 \cdot x\right)} \]
    Proof

Alternatives

Alternative 1
Error28.8
Cost64
\[1 \]

Error

Reproduce?

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