
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
def code(x, eps): return math.tan((x + eps)) - math.tan(x)
function code(x, eps) return Float64(tan(Float64(x + eps)) - tan(x)) end
function tmp = code(x, eps) tmp = tan((x + eps)) - tan(x); end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan \left(x + \varepsilon\right) - \tan x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
def code(x, eps): return math.tan((x + eps)) - math.tan(x)
function code(x, eps) return Float64(tan(Float64(x + eps)) - tan(x)) end
function tmp = code(x, eps) tmp = tan((x + eps)) - tan(x); end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan \left(x + \varepsilon\right) - \tan x
\end{array}
(FPCore (x eps) :precision binary64 (let* ((t_0 (* (tan eps) (tan x)))) (/ (* (tan x) (+ (/ (tan eps) (tan x)) t_0)) (- 1.0 t_0))))
double code(double x, double eps) {
double t_0 = tan(eps) * tan(x);
return (tan(x) * ((tan(eps) / tan(x)) + t_0)) / (1.0 - t_0);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
t_0 = tan(eps) * tan(x)
code = (tan(x) * ((tan(eps) / tan(x)) + t_0)) / (1.0d0 - t_0)
end function
public static double code(double x, double eps) {
double t_0 = Math.tan(eps) * Math.tan(x);
return (Math.tan(x) * ((Math.tan(eps) / Math.tan(x)) + t_0)) / (1.0 - t_0);
}
def code(x, eps): t_0 = math.tan(eps) * math.tan(x) return (math.tan(x) * ((math.tan(eps) / math.tan(x)) + t_0)) / (1.0 - t_0)
function code(x, eps) t_0 = Float64(tan(eps) * tan(x)) return Float64(Float64(tan(x) * Float64(Float64(tan(eps) / tan(x)) + t_0)) / Float64(1.0 - t_0)) end
function tmp = code(x, eps) t_0 = tan(eps) * tan(x); tmp = (tan(x) * ((tan(eps) / tan(x)) + t_0)) / (1.0 - t_0); end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[eps], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]}, N[(N[(N[Tan[x], $MachinePrecision] * N[(N[(N[Tan[eps], $MachinePrecision] / N[Tan[x], $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision] / N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \varepsilon \cdot \tan x\\
\frac{\tan x \cdot \left(\frac{\tan \varepsilon}{\tan x} + t\_0\right)}{1 - t\_0}
\end{array}
\end{array}
Initial program 61.0%
tan-sumN/A
tan-quotN/A
clear-numN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr60.4%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified99.7%
associate-/r*N/A
associate-*r/N/A
*-commutativeN/A
frac-timesN/A
tan-quotN/A
tan-quotN/A
*-commutativeN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x eps) :precision binary64 (/ (* (tan x) (* (tan eps) (+ (tan x) (/ 1.0 (tan x))))) (- 1.0 (* (tan eps) (tan x)))))
double code(double x, double eps) {
return (tan(x) * (tan(eps) * (tan(x) + (1.0 / tan(x))))) / (1.0 - (tan(eps) * tan(x)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (tan(x) * (tan(eps) * (tan(x) + (1.0d0 / tan(x))))) / (1.0d0 - (tan(eps) * tan(x)))
end function
public static double code(double x, double eps) {
return (Math.tan(x) * (Math.tan(eps) * (Math.tan(x) + (1.0 / Math.tan(x))))) / (1.0 - (Math.tan(eps) * Math.tan(x)));
}
def code(x, eps): return (math.tan(x) * (math.tan(eps) * (math.tan(x) + (1.0 / math.tan(x))))) / (1.0 - (math.tan(eps) * math.tan(x)))
function code(x, eps) return Float64(Float64(tan(x) * Float64(tan(eps) * Float64(tan(x) + Float64(1.0 / tan(x))))) / Float64(1.0 - Float64(tan(eps) * tan(x)))) end
function tmp = code(x, eps) tmp = (tan(x) * (tan(eps) * (tan(x) + (1.0 / tan(x))))) / (1.0 - (tan(eps) * tan(x))); end
code[x_, eps_] := N[(N[(N[Tan[x], $MachinePrecision] * N[(N[Tan[eps], $MachinePrecision] * N[(N[Tan[x], $MachinePrecision] + N[(1.0 / N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[eps], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\tan x \cdot \left(\tan \varepsilon \cdot \left(\tan x + \frac{1}{\tan x}\right)\right)}{1 - \tan \varepsilon \cdot \tan x}
\end{array}
Initial program 61.0%
tan-sumN/A
tan-quotN/A
clear-numN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr60.4%
Taylor expanded in x around inf
/-lowering-/.f64N/A
Simplified99.7%
associate-/r*N/A
associate-*r/N/A
*-commutativeN/A
frac-timesN/A
tan-quotN/A
tan-quotN/A
*-commutativeN/A
/-lowering-/.f64N/A
Applied egg-rr99.8%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x eps) :precision binary64 (* (tan x) (/ (/ eps (* (sin x) (cos x))) (- 1.0 (* (tan eps) (tan x))))))
double code(double x, double eps) {
return tan(x) * ((eps / (sin(x) * cos(x))) / (1.0 - (tan(eps) * tan(x))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan(x) * ((eps / (sin(x) * cos(x))) / (1.0d0 - (tan(eps) * tan(x))))
end function
public static double code(double x, double eps) {
return Math.tan(x) * ((eps / (Math.sin(x) * Math.cos(x))) / (1.0 - (Math.tan(eps) * Math.tan(x))));
}
def code(x, eps): return math.tan(x) * ((eps / (math.sin(x) * math.cos(x))) / (1.0 - (math.tan(eps) * math.tan(x))))
function code(x, eps) return Float64(tan(x) * Float64(Float64(eps / Float64(sin(x) * cos(x))) / Float64(1.0 - Float64(tan(eps) * tan(x))))) end
function tmp = code(x, eps) tmp = tan(x) * ((eps / (sin(x) * cos(x))) / (1.0 - (tan(eps) * tan(x)))); end
code[x_, eps_] := N[(N[Tan[x], $MachinePrecision] * N[(N[(eps / N[(N[Sin[x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[eps], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan x \cdot \frac{\frac{\varepsilon}{\sin x \cdot \cos x}}{1 - \tan \varepsilon \cdot \tan x}
\end{array}
Initial program 61.0%
tan-sumN/A
tan-quotN/A
clear-numN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr60.4%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.1%
Simplified99.1%
un-div-invN/A
associate-/r/N/A
*-lowering-*.f64N/A
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x eps) :precision binary64 (* (/ eps (* (sin x) (cos x))) (/ (tan x) (- 1.0 (* (tan eps) (tan x))))))
double code(double x, double eps) {
return (eps / (sin(x) * cos(x))) * (tan(x) / (1.0 - (tan(eps) * tan(x))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (eps / (sin(x) * cos(x))) * (tan(x) / (1.0d0 - (tan(eps) * tan(x))))
end function
public static double code(double x, double eps) {
return (eps / (Math.sin(x) * Math.cos(x))) * (Math.tan(x) / (1.0 - (Math.tan(eps) * Math.tan(x))));
}
def code(x, eps): return (eps / (math.sin(x) * math.cos(x))) * (math.tan(x) / (1.0 - (math.tan(eps) * math.tan(x))))
function code(x, eps) return Float64(Float64(eps / Float64(sin(x) * cos(x))) * Float64(tan(x) / Float64(1.0 - Float64(tan(eps) * tan(x))))) end
function tmp = code(x, eps) tmp = (eps / (sin(x) * cos(x))) * (tan(x) / (1.0 - (tan(eps) * tan(x)))); end
code[x_, eps_] := N[(N[(eps / N[(N[Sin[x], $MachinePrecision] * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[Tan[x], $MachinePrecision] / N[(1.0 - N[(N[Tan[eps], $MachinePrecision] * N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\varepsilon}{\sin x \cdot \cos x} \cdot \frac{\tan x}{1 - \tan \varepsilon \cdot \tan x}
\end{array}
Initial program 61.0%
tan-sumN/A
tan-quotN/A
clear-numN/A
frac-subN/A
/-lowering-/.f64N/A
Applied egg-rr60.4%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f64N/A
/-lowering-/.f64N/A
cos-lowering-cos.f64N/A
sin-lowering-sin.f6499.1%
Simplified99.1%
div-invN/A
*-lowering-*.f64N/A
Applied egg-rr99.1%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (tan (+ eps x))))
(if (<= (- t_0 (tan x)) 2e-11)
(+
(* eps (+ 1.0 (* 0.3333333333333333 (* eps eps))))
(*
x
(+
(* eps (* x (+ 1.0 (* (* eps eps) 1.3333333333333333))))
(* (* eps eps) (+ 1.0 (* (* eps eps) 0.6666666666666666))))))
(+ t_0 (/ 1.0 (/ -1.0 (tan x)))))))
double code(double x, double eps) {
double t_0 = tan((eps + x));
double tmp;
if ((t_0 - tan(x)) <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = t_0 + (1.0 / (-1.0 / tan(x)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = tan((eps + x))
if ((t_0 - tan(x)) <= 2d-11) then
tmp = (eps * (1.0d0 + (0.3333333333333333d0 * (eps * eps)))) + (x * ((eps * (x * (1.0d0 + ((eps * eps) * 1.3333333333333333d0)))) + ((eps * eps) * (1.0d0 + ((eps * eps) * 0.6666666666666666d0)))))
else
tmp = t_0 + (1.0d0 / ((-1.0d0) / tan(x)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.tan((eps + x));
double tmp;
if ((t_0 - Math.tan(x)) <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = t_0 + (1.0 / (-1.0 / Math.tan(x)));
}
return tmp;
}
def code(x, eps): t_0 = math.tan((eps + x)) tmp = 0 if (t_0 - math.tan(x)) <= 2e-11: tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))) else: tmp = t_0 + (1.0 / (-1.0 / math.tan(x))) return tmp
function code(x, eps) t_0 = tan(Float64(eps + x)) tmp = 0.0 if (Float64(t_0 - tan(x)) <= 2e-11) tmp = Float64(Float64(eps * Float64(1.0 + Float64(0.3333333333333333 * Float64(eps * eps)))) + Float64(x * Float64(Float64(eps * Float64(x * Float64(1.0 + Float64(Float64(eps * eps) * 1.3333333333333333)))) + Float64(Float64(eps * eps) * Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)))))); else tmp = Float64(t_0 + Float64(1.0 / Float64(-1.0 / tan(x)))); end return tmp end
function tmp_2 = code(x, eps) t_0 = tan((eps + x)); tmp = 0.0; if ((t_0 - tan(x)) <= 2e-11) tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))); else tmp = t_0 + (1.0 / (-1.0 / tan(x))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Tan[N[(eps + x), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$0 - N[Tan[x], $MachinePrecision]), $MachinePrecision], 2e-11], N[(N[(eps * N[(1.0 + N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(eps * N[(x * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + N[(1.0 / N[(-1.0 / N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \left(\varepsilon + x\right)\\
\mathbf{if}\;t\_0 - \tan x \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\varepsilon \cdot \left(1 + 0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) + x \cdot \left(\varepsilon \cdot \left(x \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 1.3333333333333333\right)\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + \frac{1}{\frac{-1}{\tan x}}\\
\end{array}
\end{array}
if (-.f64 (tan.f64 (+.f64 x eps)) (tan.f64 x)) < 1.99999999999999988e-11Initial program 61.0%
Taylor expanded in eps around 0
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
Simplified99.9%
if 1.99999999999999988e-11 < (-.f64 (tan.f64 (+.f64 x eps)) (tan.f64 x)) Initial program 62.4%
tan-quotN/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
tan-quotN/A
/-lowering-/.f64N/A
tan-lowering-tan.f6462.4%
Applied egg-rr62.4%
Final simplification98.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- (tan (+ eps x)) (tan x))))
(if (<= t_0 2e-11)
(+
(* eps (+ 1.0 (* 0.3333333333333333 (* eps eps))))
(*
x
(+
(* eps (* x (+ 1.0 (* (* eps eps) 1.3333333333333333))))
(* (* eps eps) (+ 1.0 (* (* eps eps) 0.6666666666666666))))))
t_0)))
double code(double x, double eps) {
double t_0 = tan((eps + x)) - tan(x);
double tmp;
if (t_0 <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: tmp
t_0 = tan((eps + x)) - tan(x)
if (t_0 <= 2d-11) then
tmp = (eps * (1.0d0 + (0.3333333333333333d0 * (eps * eps)))) + (x * ((eps * (x * (1.0d0 + ((eps * eps) * 1.3333333333333333d0)))) + ((eps * eps) * (1.0d0 + ((eps * eps) * 0.6666666666666666d0)))))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.tan((eps + x)) - Math.tan(x);
double tmp;
if (t_0 <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, eps): t_0 = math.tan((eps + x)) - math.tan(x) tmp = 0 if t_0 <= 2e-11: tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))) else: tmp = t_0 return tmp
function code(x, eps) t_0 = Float64(tan(Float64(eps + x)) - tan(x)) tmp = 0.0 if (t_0 <= 2e-11) tmp = Float64(Float64(eps * Float64(1.0 + Float64(0.3333333333333333 * Float64(eps * eps)))) + Float64(x * Float64(Float64(eps * Float64(x * Float64(1.0 + Float64(Float64(eps * eps) * 1.3333333333333333)))) + Float64(Float64(eps * eps) * Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)))))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, eps) t_0 = tan((eps + x)) - tan(x); tmp = 0.0; if (t_0 <= 2e-11) tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[N[(eps + x), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 2e-11], N[(N[(eps * N[(1.0 + N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(eps * N[(x * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan \left(\varepsilon + x\right) - \tan x\\
\mathbf{if}\;t\_0 \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\varepsilon \cdot \left(1 + 0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) + x \cdot \left(\varepsilon \cdot \left(x \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 1.3333333333333333\right)\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (-.f64 (tan.f64 (+.f64 x eps)) (tan.f64 x)) < 1.99999999999999988e-11Initial program 61.0%
Taylor expanded in eps around 0
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
Simplified99.9%
if 1.99999999999999988e-11 < (-.f64 (tan.f64 (+.f64 x eps)) (tan.f64 x)) Initial program 62.4%
Final simplification98.6%
(FPCore (x eps) :precision binary64 (* eps (+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0)))))
double code(double x, double eps) {
return eps * (1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (1.0d0 + ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
end function
public static double code(double x, double eps) {
return eps * (1.0 + (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
}
def code(x, eps): return eps * (1.0 + (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)))
function code(x, eps) return Float64(eps * Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))) end
function tmp = code(x, eps) tmp = eps * (1.0 + ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); end
code[x_, eps_] := N[(eps * N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right)
\end{array}
Initial program 61.0%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
sub-negN/A
+-lowering-+.f64N/A
mul-1-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
pow-lowering-pow.f64N/A
sin-lowering-sin.f64N/A
pow-lowering-pow.f64N/A
cos-lowering-cos.f6498.3%
Simplified98.3%
(FPCore (x eps)
:precision binary64
(if (<= eps 2e-11)
(+
(* eps (+ 1.0 (* 0.3333333333333333 (* eps eps))))
(*
x
(+
(* eps (* x (+ 1.0 (* (* eps eps) 1.3333333333333333))))
(* (* eps eps) (+ 1.0 (* (* eps eps) 0.6666666666666666))))))
(+ (tan (+ eps x)) (/ 1.0 (* (cos x) (/ -1.0 (sin x)))))))
double code(double x, double eps) {
double tmp;
if (eps <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = tan((eps + x)) + (1.0 / (cos(x) * (-1.0 / sin(x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= 2d-11) then
tmp = (eps * (1.0d0 + (0.3333333333333333d0 * (eps * eps)))) + (x * ((eps * (x * (1.0d0 + ((eps * eps) * 1.3333333333333333d0)))) + ((eps * eps) * (1.0d0 + ((eps * eps) * 0.6666666666666666d0)))))
else
tmp = tan((eps + x)) + (1.0d0 / (cos(x) * ((-1.0d0) / sin(x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= 2e-11) {
tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
} else {
tmp = Math.tan((eps + x)) + (1.0 / (Math.cos(x) * (-1.0 / Math.sin(x))));
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= 2e-11: tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))) else: tmp = math.tan((eps + x)) + (1.0 / (math.cos(x) * (-1.0 / math.sin(x)))) return tmp
function code(x, eps) tmp = 0.0 if (eps <= 2e-11) tmp = Float64(Float64(eps * Float64(1.0 + Float64(0.3333333333333333 * Float64(eps * eps)))) + Float64(x * Float64(Float64(eps * Float64(x * Float64(1.0 + Float64(Float64(eps * eps) * 1.3333333333333333)))) + Float64(Float64(eps * eps) * Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)))))); else tmp = Float64(tan(Float64(eps + x)) + Float64(1.0 / Float64(cos(x) * Float64(-1.0 / sin(x))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= 2e-11) tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))); else tmp = tan((eps + x)) + (1.0 / (cos(x) * (-1.0 / sin(x)))); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, 2e-11], N[(N[(eps * N[(1.0 + N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(eps * N[(x * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Tan[N[(eps + x), $MachinePrecision]], $MachinePrecision] + N[(1.0 / N[(N[Cos[x], $MachinePrecision] * N[(-1.0 / N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq 2 \cdot 10^{-11}:\\
\;\;\;\;\varepsilon \cdot \left(1 + 0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) + x \cdot \left(\varepsilon \cdot \left(x \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 1.3333333333333333\right)\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \left(\varepsilon + x\right) + \frac{1}{\cos x \cdot \frac{-1}{\sin x}}\\
\end{array}
\end{array}
if eps < 1.99999999999999988e-11Initial program 61.0%
Taylor expanded in eps around 0
Simplified100.0%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
Simplified99.9%
if 1.99999999999999988e-11 < eps Initial program 62.4%
tan-quotN/A
clear-numN/A
/-lowering-/.f64N/A
clear-numN/A
tan-quotN/A
/-lowering-/.f64N/A
tan-lowering-tan.f6462.4%
Applied egg-rr62.4%
tan-quotN/A
associate-/r/N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6462.5%
Applied egg-rr62.5%
Final simplification98.6%
(FPCore (x eps)
:precision binary64
(+
(* eps (+ 1.0 (* 0.3333333333333333 (* eps eps))))
(*
x
(+
(* eps (* x (+ 1.0 (* (* eps eps) 1.3333333333333333))))
(* (* eps eps) (+ 1.0 (* (* eps eps) 0.6666666666666666)))))))
double code(double x, double eps) {
return (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = (eps * (1.0d0 + (0.3333333333333333d0 * (eps * eps)))) + (x * ((eps * (x * (1.0d0 + ((eps * eps) * 1.3333333333333333d0)))) + ((eps * eps) * (1.0d0 + ((eps * eps) * 0.6666666666666666d0)))))
end function
public static double code(double x, double eps) {
return (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))));
}
def code(x, eps): return (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666)))))
function code(x, eps) return Float64(Float64(eps * Float64(1.0 + Float64(0.3333333333333333 * Float64(eps * eps)))) + Float64(x * Float64(Float64(eps * Float64(x * Float64(1.0 + Float64(Float64(eps * eps) * 1.3333333333333333)))) + Float64(Float64(eps * eps) * Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)))))) end
function tmp = code(x, eps) tmp = (eps * (1.0 + (0.3333333333333333 * (eps * eps)))) + (x * ((eps * (x * (1.0 + ((eps * eps) * 1.3333333333333333)))) + ((eps * eps) * (1.0 + ((eps * eps) * 0.6666666666666666))))); end
code[x_, eps_] := N[(N[(eps * N[(1.0 + N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(N[(eps * N[(x * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(1 + 0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right)\right) + x \cdot \left(\varepsilon \cdot \left(x \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 1.3333333333333333\right)\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right)\right)
\end{array}
Initial program 61.0%
Taylor expanded in eps around 0
Simplified99.6%
Taylor expanded in x around 0
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
Simplified97.0%
(FPCore (x eps)
:precision binary64
(*
eps
(+
(* 0.3333333333333333 (* eps eps))
(+
1.0
(*
x
(+
(* x (+ 1.0 (* (* eps eps) 1.3333333333333333)))
(* eps (+ 1.0 (* (* eps eps) 0.6666666666666666)))))))))
double code(double x, double eps) {
return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + (x * ((x * (1.0 + ((eps * eps) * 1.3333333333333333))) + (eps * (1.0 + ((eps * eps) * 0.6666666666666666)))))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * ((0.3333333333333333d0 * (eps * eps)) + (1.0d0 + (x * ((x * (1.0d0 + ((eps * eps) * 1.3333333333333333d0))) + (eps * (1.0d0 + ((eps * eps) * 0.6666666666666666d0)))))))
end function
public static double code(double x, double eps) {
return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + (x * ((x * (1.0 + ((eps * eps) * 1.3333333333333333))) + (eps * (1.0 + ((eps * eps) * 0.6666666666666666)))))));
}
def code(x, eps): return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + (x * ((x * (1.0 + ((eps * eps) * 1.3333333333333333))) + (eps * (1.0 + ((eps * eps) * 0.6666666666666666)))))))
function code(x, eps) return Float64(eps * Float64(Float64(0.3333333333333333 * Float64(eps * eps)) + Float64(1.0 + Float64(x * Float64(Float64(x * Float64(1.0 + Float64(Float64(eps * eps) * 1.3333333333333333))) + Float64(eps * Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)))))))) end
function tmp = code(x, eps) tmp = eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + (x * ((x * (1.0 + ((eps * eps) * 1.3333333333333333))) + (eps * (1.0 + ((eps * eps) * 0.6666666666666666))))))); end
code[x_, eps_] := N[(eps * N[(N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(x * N[(N[(x * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 1.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(eps * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right) + \left(1 + x \cdot \left(x \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 1.3333333333333333\right) + \varepsilon \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right)\right)\right)\right)
\end{array}
Initial program 61.0%
Taylor expanded in eps around 0
Simplified99.6%
Taylor expanded in x around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
Simplified97.0%
(FPCore (x eps) :precision binary64 (* eps (+ (* 0.3333333333333333 (* eps eps)) (+ 1.0 (* (+ 1.0 (* (* eps eps) 0.6666666666666666)) (* eps x))))))
double code(double x, double eps) {
return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + ((1.0 + ((eps * eps) * 0.6666666666666666)) * (eps * x))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * ((0.3333333333333333d0 * (eps * eps)) + (1.0d0 + ((1.0d0 + ((eps * eps) * 0.6666666666666666d0)) * (eps * x))))
end function
public static double code(double x, double eps) {
return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + ((1.0 + ((eps * eps) * 0.6666666666666666)) * (eps * x))));
}
def code(x, eps): return eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + ((1.0 + ((eps * eps) * 0.6666666666666666)) * (eps * x))))
function code(x, eps) return Float64(eps * Float64(Float64(0.3333333333333333 * Float64(eps * eps)) + Float64(1.0 + Float64(Float64(1.0 + Float64(Float64(eps * eps) * 0.6666666666666666)) * Float64(eps * x))))) end
function tmp = code(x, eps) tmp = eps * ((0.3333333333333333 * (eps * eps)) + (1.0 + ((1.0 + ((eps * eps) * 0.6666666666666666)) * (eps * x)))); end
code[x_, eps_] := N[(eps * N[(N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * 0.6666666666666666), $MachinePrecision]), $MachinePrecision] * N[(eps * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right) + \left(1 + \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.6666666666666666\right) \cdot \left(\varepsilon \cdot x\right)\right)\right)
\end{array}
Initial program 61.0%
Taylor expanded in eps around 0
Simplified99.6%
Taylor expanded in x around 0
associate-+r+N/A
+-commutativeN/A
associate-+l+N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.7%
Simplified96.7%
Final simplification96.7%
(FPCore (x eps)
:precision binary64
(*
eps
(+
1.0
(*
(* eps eps)
(+ 0.3333333333333333 (* (* eps eps) 0.13333333333333333))))))
double code(double x, double eps) {
return eps * (1.0 + ((eps * eps) * (0.3333333333333333 + ((eps * eps) * 0.13333333333333333))));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (1.0d0 + ((eps * eps) * (0.3333333333333333d0 + ((eps * eps) * 0.13333333333333333d0))))
end function
public static double code(double x, double eps) {
return eps * (1.0 + ((eps * eps) * (0.3333333333333333 + ((eps * eps) * 0.13333333333333333))));
}
def code(x, eps): return eps * (1.0 + ((eps * eps) * (0.3333333333333333 + ((eps * eps) * 0.13333333333333333))))
function code(x, eps) return Float64(eps * Float64(1.0 + Float64(Float64(eps * eps) * Float64(0.3333333333333333 + Float64(Float64(eps * eps) * 0.13333333333333333))))) end
function tmp = code(x, eps) tmp = eps * (1.0 + ((eps * eps) * (0.3333333333333333 + ((eps * eps) * 0.13333333333333333)))); end
code[x_, eps_] := N[(eps * N[(1.0 + N[(N[(eps * eps), $MachinePrecision] * N[(0.3333333333333333 + N[(N[(eps * eps), $MachinePrecision] * 0.13333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(1 + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(0.3333333333333333 + \left(\varepsilon \cdot \varepsilon\right) \cdot 0.13333333333333333\right)\right)
\end{array}
Initial program 61.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6496.7%
Simplified96.7%
Taylor expanded in eps around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.7%
Simplified96.7%
(FPCore (x eps) :precision binary64 (* eps (+ 1.0 (* 0.3333333333333333 (* eps eps)))))
double code(double x, double eps) {
return eps * (1.0 + (0.3333333333333333 * (eps * eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps * (1.0d0 + (0.3333333333333333d0 * (eps * eps)))
end function
public static double code(double x, double eps) {
return eps * (1.0 + (0.3333333333333333 * (eps * eps)));
}
def code(x, eps): return eps * (1.0 + (0.3333333333333333 * (eps * eps)))
function code(x, eps) return Float64(eps * Float64(1.0 + Float64(0.3333333333333333 * Float64(eps * eps)))) end
function tmp = code(x, eps) tmp = eps * (1.0 + (0.3333333333333333 * (eps * eps))); end
code[x_, eps_] := N[(eps * N[(1.0 + N[(0.3333333333333333 * N[(eps * eps), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\varepsilon \cdot \left(1 + 0.3333333333333333 \cdot \left(\varepsilon \cdot \varepsilon\right)\right)
\end{array}
Initial program 61.0%
Taylor expanded in eps around 0
Simplified99.6%
Taylor expanded in x around 0
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6496.7%
Simplified96.7%
(FPCore (x eps) :precision binary64 eps)
double code(double x, double eps) {
return eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps
end function
public static double code(double x, double eps) {
return eps;
}
def code(x, eps): return eps
function code(x, eps) return eps end
function tmp = code(x, eps) tmp = eps; end
code[x_, eps_] := eps
\begin{array}{l}
\\
\varepsilon
\end{array}
Initial program 61.0%
Taylor expanded in x around 0
/-lowering-/.f64N/A
sin-lowering-sin.f64N/A
cos-lowering-cos.f6496.7%
Simplified96.7%
Taylor expanded in eps around 0
Simplified96.7%
(FPCore (x eps) :precision binary64 (/ (sin eps) (* (cos x) (cos (+ x eps)))))
double code(double x, double eps) {
return sin(eps) / (cos(x) * cos((x + eps)));
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin(eps) / (cos(x) * cos((x + eps)))
end function
public static double code(double x, double eps) {
return Math.sin(eps) / (Math.cos(x) * Math.cos((x + eps)));
}
def code(x, eps): return math.sin(eps) / (math.cos(x) * math.cos((x + eps)))
function code(x, eps) return Float64(sin(eps) / Float64(cos(x) * cos(Float64(x + eps)))) end
function tmp = code(x, eps) tmp = sin(eps) / (cos(x) * cos((x + eps))); end
code[x_, eps_] := N[(N[Sin[eps], $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * N[Cos[N[(x + eps), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin \varepsilon}{\cos x \cdot \cos \left(x + \varepsilon\right)}
\end{array}
herbie shell --seed 2024155
(FPCore (x eps)
:name "2tan (problem 3.3.2)"
:precision binary64
:pre (and (and (and (<= -10000.0 x) (<= x 10000.0)) (< (* 1e-16 (fabs x)) eps)) (< eps (fabs x)))
:alt
(! :herbie-platform default (/ (sin eps) (* (cos x) (cos (+ x eps)))))
(- (tan (+ x eps)) (tan x)))