
(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 13 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 (pow (sin x) 3.0))
(t_1 (pow (cos x) 3.0))
(t_2 (/ (sin eps) (cos eps)))
(t_3 (pow (sin x) 2.0))
(t_4 (pow (cos x) 2.0))
(t_5
(-
(/ (pow (sin x) 4.0) (pow (cos x) 4.0))
(* -0.3333333333333333 (/ t_3 t_4)))))
(if (or (<= eps -0.29) (not (<= eps 0.00034)))
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (/ (tan x) (/ 1.0 (tan eps)))))
(tan x))
(+
(/ t_2 (- 1.0 (* t_2 (/ (sin x) (cos x)))))
(+
(*
(pow eps 4.0)
(- (/ (* (sin x) t_5) (cos x)) (* -0.3333333333333333 (/ t_0 t_1))))
(+
(/ (* eps t_3) t_4)
(+ (/ (* t_0 (pow eps 2.0)) t_1) (* (pow eps 3.0) t_5))))))))
double code(double x, double eps) {
double t_0 = pow(sin(x), 3.0);
double t_1 = pow(cos(x), 3.0);
double t_2 = sin(eps) / cos(eps);
double t_3 = pow(sin(x), 2.0);
double t_4 = pow(cos(x), 2.0);
double t_5 = (pow(sin(x), 4.0) / pow(cos(x), 4.0)) - (-0.3333333333333333 * (t_3 / t_4));
double tmp;
if ((eps <= -0.29) || !(eps <= 0.00034)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x);
} else {
tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + ((pow(eps, 4.0) * (((sin(x) * t_5) / cos(x)) - (-0.3333333333333333 * (t_0 / t_1)))) + (((eps * t_3) / t_4) + (((t_0 * pow(eps, 2.0)) / t_1) + (pow(eps, 3.0) * t_5))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: t_5
real(8) :: tmp
t_0 = sin(x) ** 3.0d0
t_1 = cos(x) ** 3.0d0
t_2 = sin(eps) / cos(eps)
t_3 = sin(x) ** 2.0d0
t_4 = cos(x) ** 2.0d0
t_5 = ((sin(x) ** 4.0d0) / (cos(x) ** 4.0d0)) - ((-0.3333333333333333d0) * (t_3 / t_4))
if ((eps <= (-0.29d0)) .or. (.not. (eps <= 0.00034d0))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - tan(x)
else
tmp = (t_2 / (1.0d0 - (t_2 * (sin(x) / cos(x))))) + (((eps ** 4.0d0) * (((sin(x) * t_5) / cos(x)) - ((-0.3333333333333333d0) * (t_0 / t_1)))) + (((eps * t_3) / t_4) + (((t_0 * (eps ** 2.0d0)) / t_1) + ((eps ** 3.0d0) * t_5))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow(Math.sin(x), 3.0);
double t_1 = Math.pow(Math.cos(x), 3.0);
double t_2 = Math.sin(eps) / Math.cos(eps);
double t_3 = Math.pow(Math.sin(x), 2.0);
double t_4 = Math.pow(Math.cos(x), 2.0);
double t_5 = (Math.pow(Math.sin(x), 4.0) / Math.pow(Math.cos(x), 4.0)) - (-0.3333333333333333 * (t_3 / t_4));
double tmp;
if ((eps <= -0.29) || !(eps <= 0.00034)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
} else {
tmp = (t_2 / (1.0 - (t_2 * (Math.sin(x) / Math.cos(x))))) + ((Math.pow(eps, 4.0) * (((Math.sin(x) * t_5) / Math.cos(x)) - (-0.3333333333333333 * (t_0 / t_1)))) + (((eps * t_3) / t_4) + (((t_0 * Math.pow(eps, 2.0)) / t_1) + (Math.pow(eps, 3.0) * t_5))));
}
return tmp;
}
def code(x, eps): t_0 = math.pow(math.sin(x), 3.0) t_1 = math.pow(math.cos(x), 3.0) t_2 = math.sin(eps) / math.cos(eps) t_3 = math.pow(math.sin(x), 2.0) t_4 = math.pow(math.cos(x), 2.0) t_5 = (math.pow(math.sin(x), 4.0) / math.pow(math.cos(x), 4.0)) - (-0.3333333333333333 * (t_3 / t_4)) tmp = 0 if (eps <= -0.29) or not (eps <= 0.00034): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) else: tmp = (t_2 / (1.0 - (t_2 * (math.sin(x) / math.cos(x))))) + ((math.pow(eps, 4.0) * (((math.sin(x) * t_5) / math.cos(x)) - (-0.3333333333333333 * (t_0 / t_1)))) + (((eps * t_3) / t_4) + (((t_0 * math.pow(eps, 2.0)) / t_1) + (math.pow(eps, 3.0) * t_5)))) return tmp
function code(x, eps) t_0 = sin(x) ^ 3.0 t_1 = cos(x) ^ 3.0 t_2 = Float64(sin(eps) / cos(eps)) t_3 = sin(x) ^ 2.0 t_4 = cos(x) ^ 2.0 t_5 = Float64(Float64((sin(x) ^ 4.0) / (cos(x) ^ 4.0)) - Float64(-0.3333333333333333 * Float64(t_3 / t_4))) tmp = 0.0 if ((eps <= -0.29) || !(eps <= 0.00034)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); else tmp = Float64(Float64(t_2 / Float64(1.0 - Float64(t_2 * Float64(sin(x) / cos(x))))) + Float64(Float64((eps ^ 4.0) * Float64(Float64(Float64(sin(x) * t_5) / cos(x)) - Float64(-0.3333333333333333 * Float64(t_0 / t_1)))) + Float64(Float64(Float64(eps * t_3) / t_4) + Float64(Float64(Float64(t_0 * (eps ^ 2.0)) / t_1) + Float64((eps ^ 3.0) * t_5))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin(x) ^ 3.0; t_1 = cos(x) ^ 3.0; t_2 = sin(eps) / cos(eps); t_3 = sin(x) ^ 2.0; t_4 = cos(x) ^ 2.0; t_5 = ((sin(x) ^ 4.0) / (cos(x) ^ 4.0)) - (-0.3333333333333333 * (t_3 / t_4)); tmp = 0.0; if ((eps <= -0.29) || ~((eps <= 0.00034))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); else tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + (((eps ^ 4.0) * (((sin(x) * t_5) / cos(x)) - (-0.3333333333333333 * (t_0 / t_1)))) + (((eps * t_3) / t_4) + (((t_0 * (eps ^ 2.0)) / t_1) + ((eps ^ 3.0) * t_5)))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[(N[Power[N[Sin[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] - N[(-0.3333333333333333 * N[(t$95$3 / t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eps, -0.29], N[Not[LessEqual[eps, 0.00034]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[(1.0 - N[(t$95$2 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[eps, 4.0], $MachinePrecision] * N[(N[(N[(N[Sin[x], $MachinePrecision] * t$95$5), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] - N[(-0.3333333333333333 * N[(t$95$0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(eps * t$95$3), $MachinePrecision] / t$95$4), $MachinePrecision] + N[(N[(N[(t$95$0 * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[Power[eps, 3.0], $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin x}^{3}\\
t_1 := {\cos x}^{3}\\
t_2 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
t_3 := {\sin x}^{2}\\
t_4 := {\cos x}^{2}\\
t_5 := \frac{{\sin x}^{4}}{{\cos x}^{4}} - -0.3333333333333333 \cdot \frac{t_3}{t_4}\\
\mathbf{if}\;\varepsilon \leq -0.29 \lor \neg \left(\varepsilon \leq 0.00034\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{1 - t_2 \cdot \frac{\sin x}{\cos x}} + \left({\varepsilon}^{4} \cdot \left(\frac{\sin x \cdot t_5}{\cos x} - -0.3333333333333333 \cdot \frac{t_0}{t_1}\right) + \left(\frac{\varepsilon \cdot t_3}{t_4} + \left(\frac{t_0 \cdot {\varepsilon}^{2}}{t_1} + {\varepsilon}^{3} \cdot t_5\right)\right)\right)\\
\end{array}
\end{array}
if eps < -0.28999999999999998 or 3.4e-4 < eps Initial program 54.9%
tan-sum99.5%
div-inv99.5%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
tan-quot99.5%
clear-num99.5%
un-div-inv99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
if -0.28999999999999998 < eps < 3.4e-4Initial program 28.0%
tan-sum29.2%
div-inv29.2%
fma-neg29.2%
Applied egg-rr29.2%
fma-neg29.2%
associate-*r/29.2%
*-rgt-identity29.2%
Simplified29.2%
Taylor expanded in x around inf 29.2%
associate--l+60.4%
Simplified60.4%
clear-num60.4%
clear-num60.4%
frac-times60.4%
metadata-eval60.4%
clear-num60.4%
tan-quot60.4%
clear-num60.4%
tan-quot60.4%
Applied egg-rr60.4%
associate-/r*60.4%
remove-double-div60.4%
associate-/l*60.4%
/-rgt-identity60.4%
*-commutative60.4%
Simplified60.4%
Taylor expanded in eps around 0 99.7%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (sin x) 2.0))
(t_1 (pow (cos x) 2.0))
(t_2 (/ (sin eps) (cos eps))))
(if (or (<= eps -0.29) (not (<= eps 5.5e-5)))
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (/ (tan x) (/ 1.0 (tan eps)))))
(tan x))
(+
(/ t_2 (- 1.0 (* t_2 (/ (sin x) (cos x)))))
(+
(* t_0 (/ eps t_1))
(+
(/ (* eps eps) (/ (pow (cos x) 3.0) (pow (sin x) 3.0)))
(*
(pow eps 3.0)
(-
(/ (pow (sin x) 4.0) (pow (cos x) 4.0))
(* t_0 (/ -0.3333333333333333 t_1))))))))))
double code(double x, double eps) {
double t_0 = pow(sin(x), 2.0);
double t_1 = pow(cos(x), 2.0);
double t_2 = sin(eps) / cos(eps);
double tmp;
if ((eps <= -0.29) || !(eps <= 5.5e-5)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x);
} else {
tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + ((t_0 * (eps / t_1)) + (((eps * eps) / (pow(cos(x), 3.0) / pow(sin(x), 3.0))) + (pow(eps, 3.0) * ((pow(sin(x), 4.0) / pow(cos(x), 4.0)) - (t_0 * (-0.3333333333333333 / t_1))))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sin(x) ** 2.0d0
t_1 = cos(x) ** 2.0d0
t_2 = sin(eps) / cos(eps)
if ((eps <= (-0.29d0)) .or. (.not. (eps <= 5.5d-5))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - tan(x)
else
tmp = (t_2 / (1.0d0 - (t_2 * (sin(x) / cos(x))))) + ((t_0 * (eps / t_1)) + (((eps * eps) / ((cos(x) ** 3.0d0) / (sin(x) ** 3.0d0))) + ((eps ** 3.0d0) * (((sin(x) ** 4.0d0) / (cos(x) ** 4.0d0)) - (t_0 * ((-0.3333333333333333d0) / t_1))))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow(Math.sin(x), 2.0);
double t_1 = Math.pow(Math.cos(x), 2.0);
double t_2 = Math.sin(eps) / Math.cos(eps);
double tmp;
if ((eps <= -0.29) || !(eps <= 5.5e-5)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
} else {
tmp = (t_2 / (1.0 - (t_2 * (Math.sin(x) / Math.cos(x))))) + ((t_0 * (eps / t_1)) + (((eps * eps) / (Math.pow(Math.cos(x), 3.0) / Math.pow(Math.sin(x), 3.0))) + (Math.pow(eps, 3.0) * ((Math.pow(Math.sin(x), 4.0) / Math.pow(Math.cos(x), 4.0)) - (t_0 * (-0.3333333333333333 / t_1))))));
}
return tmp;
}
def code(x, eps): t_0 = math.pow(math.sin(x), 2.0) t_1 = math.pow(math.cos(x), 2.0) t_2 = math.sin(eps) / math.cos(eps) tmp = 0 if (eps <= -0.29) or not (eps <= 5.5e-5): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) else: tmp = (t_2 / (1.0 - (t_2 * (math.sin(x) / math.cos(x))))) + ((t_0 * (eps / t_1)) + (((eps * eps) / (math.pow(math.cos(x), 3.0) / math.pow(math.sin(x), 3.0))) + (math.pow(eps, 3.0) * ((math.pow(math.sin(x), 4.0) / math.pow(math.cos(x), 4.0)) - (t_0 * (-0.3333333333333333 / t_1)))))) return tmp
function code(x, eps) t_0 = sin(x) ^ 2.0 t_1 = cos(x) ^ 2.0 t_2 = Float64(sin(eps) / cos(eps)) tmp = 0.0 if ((eps <= -0.29) || !(eps <= 5.5e-5)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); else tmp = Float64(Float64(t_2 / Float64(1.0 - Float64(t_2 * Float64(sin(x) / cos(x))))) + Float64(Float64(t_0 * Float64(eps / t_1)) + Float64(Float64(Float64(eps * eps) / Float64((cos(x) ^ 3.0) / (sin(x) ^ 3.0))) + Float64((eps ^ 3.0) * Float64(Float64((sin(x) ^ 4.0) / (cos(x) ^ 4.0)) - Float64(t_0 * Float64(-0.3333333333333333 / t_1))))))); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin(x) ^ 2.0; t_1 = cos(x) ^ 2.0; t_2 = sin(eps) / cos(eps); tmp = 0.0; if ((eps <= -0.29) || ~((eps <= 5.5e-5))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); else tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + ((t_0 * (eps / t_1)) + (((eps * eps) / ((cos(x) ^ 3.0) / (sin(x) ^ 3.0))) + ((eps ^ 3.0) * (((sin(x) ^ 4.0) / (cos(x) ^ 4.0)) - (t_0 * (-0.3333333333333333 / t_1)))))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eps, -0.29], N[Not[LessEqual[eps, 5.5e-5]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$2 / N[(1.0 - N[(t$95$2 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$0 * N[(eps / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(eps * eps), $MachinePrecision] / N[(N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(N[Power[N[Sin[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[(-0.3333333333333333 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin x}^{2}\\
t_1 := {\cos x}^{2}\\
t_2 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
\mathbf{if}\;\varepsilon \leq -0.29 \lor \neg \left(\varepsilon \leq 5.5 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{t_2}{1 - t_2 \cdot \frac{\sin x}{\cos x}} + \left(t_0 \cdot \frac{\varepsilon}{t_1} + \left(\frac{\varepsilon \cdot \varepsilon}{\frac{{\cos x}^{3}}{{\sin x}^{3}}} + {\varepsilon}^{3} \cdot \left(\frac{{\sin x}^{4}}{{\cos x}^{4}} - t_0 \cdot \frac{-0.3333333333333333}{t_1}\right)\right)\right)\\
\end{array}
\end{array}
if eps < -0.28999999999999998 or 5.5000000000000002e-5 < eps Initial program 54.9%
tan-sum99.5%
div-inv99.5%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
tan-quot99.5%
clear-num99.5%
un-div-inv99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
if -0.28999999999999998 < eps < 5.5000000000000002e-5Initial program 28.0%
tan-sum29.2%
div-inv29.2%
fma-neg29.2%
Applied egg-rr29.2%
fma-neg29.2%
associate-*r/29.2%
*-rgt-identity29.2%
Simplified29.2%
Taylor expanded in x around inf 29.2%
associate--l+60.4%
Simplified60.4%
clear-num60.4%
clear-num60.4%
frac-times60.4%
metadata-eval60.4%
clear-num60.4%
tan-quot60.4%
clear-num60.4%
tan-quot60.4%
Applied egg-rr60.4%
associate-/r*60.4%
remove-double-div60.4%
associate-/l*60.4%
/-rgt-identity60.4%
*-commutative60.4%
Simplified60.4%
Taylor expanded in eps around 0 99.7%
*-commutative99.7%
*-lft-identity99.7%
times-frac99.7%
/-rgt-identity99.7%
mul-1-neg99.7%
unsub-neg99.7%
Simplified99.7%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (sin eps) (cos eps))))
(if (or (<= eps -0.29) (not (<= eps 2.9e-27)))
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (/ (tan x) (/ 1.0 (tan eps)))))
(tan x))
(+
(/ t_0 (- 1.0 (* t_0 (/ (sin x) (cos x)))))
(+
(/ (* eps (pow (sin x) 2.0)) (pow (cos x) 2.0))
(/ (* (pow (sin x) 3.0) (pow eps 2.0)) (pow (cos x) 3.0)))))))
double code(double x, double eps) {
double t_0 = sin(eps) / cos(eps);
double tmp;
if ((eps <= -0.29) || !(eps <= 2.9e-27)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x);
} else {
tmp = (t_0 / (1.0 - (t_0 * (sin(x) / cos(x))))) + (((eps * pow(sin(x), 2.0)) / pow(cos(x), 2.0)) + ((pow(sin(x), 3.0) * pow(eps, 2.0)) / pow(cos(x), 3.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 = sin(eps) / cos(eps)
if ((eps <= (-0.29d0)) .or. (.not. (eps <= 2.9d-27))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - tan(x)
else
tmp = (t_0 / (1.0d0 - (t_0 * (sin(x) / cos(x))))) + (((eps * (sin(x) ** 2.0d0)) / (cos(x) ** 2.0d0)) + (((sin(x) ** 3.0d0) * (eps ** 2.0d0)) / (cos(x) ** 3.0d0)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.sin(eps) / Math.cos(eps);
double tmp;
if ((eps <= -0.29) || !(eps <= 2.9e-27)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
} else {
tmp = (t_0 / (1.0 - (t_0 * (Math.sin(x) / Math.cos(x))))) + (((eps * Math.pow(Math.sin(x), 2.0)) / Math.pow(Math.cos(x), 2.0)) + ((Math.pow(Math.sin(x), 3.0) * Math.pow(eps, 2.0)) / Math.pow(Math.cos(x), 3.0)));
}
return tmp;
}
def code(x, eps): t_0 = math.sin(eps) / math.cos(eps) tmp = 0 if (eps <= -0.29) or not (eps <= 2.9e-27): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) else: tmp = (t_0 / (1.0 - (t_0 * (math.sin(x) / math.cos(x))))) + (((eps * math.pow(math.sin(x), 2.0)) / math.pow(math.cos(x), 2.0)) + ((math.pow(math.sin(x), 3.0) * math.pow(eps, 2.0)) / math.pow(math.cos(x), 3.0))) return tmp
function code(x, eps) t_0 = Float64(sin(eps) / cos(eps)) tmp = 0.0 if ((eps <= -0.29) || !(eps <= 2.9e-27)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(t_0 * Float64(sin(x) / cos(x))))) + Float64(Float64(Float64(eps * (sin(x) ^ 2.0)) / (cos(x) ^ 2.0)) + Float64(Float64((sin(x) ^ 3.0) * (eps ^ 2.0)) / (cos(x) ^ 3.0)))); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin(eps) / cos(eps); tmp = 0.0; if ((eps <= -0.29) || ~((eps <= 2.9e-27))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); else tmp = (t_0 / (1.0 - (t_0 * (sin(x) / cos(x))))) + (((eps * (sin(x) ^ 2.0)) / (cos(x) ^ 2.0)) + (((sin(x) ^ 3.0) * (eps ^ 2.0)) / (cos(x) ^ 3.0))); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[eps, -0.29], N[Not[LessEqual[eps, 2.9e-27]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(1.0 - N[(t$95$0 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(eps * N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision] * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
\mathbf{if}\;\varepsilon \leq -0.29 \lor \neg \left(\varepsilon \leq 2.9 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - t_0 \cdot \frac{\sin x}{\cos x}} + \left(\frac{\varepsilon \cdot {\sin x}^{2}}{{\cos x}^{2}} + \frac{{\sin x}^{3} \cdot {\varepsilon}^{2}}{{\cos x}^{3}}\right)\\
\end{array}
\end{array}
if eps < -0.28999999999999998 or 2.90000000000000004e-27 < eps Initial program 56.1%
tan-sum99.4%
div-inv99.4%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.4%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
tan-quot99.4%
clear-num99.4%
un-div-inv99.4%
clear-num99.4%
tan-quot99.4%
Applied egg-rr99.4%
if -0.28999999999999998 < eps < 2.90000000000000004e-27Initial program 24.8%
tan-sum25.4%
div-inv25.4%
fma-neg25.4%
Applied egg-rr25.4%
fma-neg25.4%
associate-*r/25.4%
*-rgt-identity25.4%
Simplified25.4%
Taylor expanded in x around inf 25.4%
associate--l+58.4%
Simplified58.4%
Taylor expanded in eps around 0 99.7%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (or (<= eps -2.3e-7) (not (<= eps 2.9e-27)))
(- (/ (+ (tan x) (tan eps)) (- 1.0 (/ (tan x) (/ 1.0 (tan eps))))) (tan x))
(+
(+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(*
(* eps eps)
(+ (/ (sin x) (cos x)) (/ (pow (sin x) 3.0) (pow (cos x) 3.0)))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -2.3e-7) || !(eps <= 2.9e-27)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x);
} else {
tmp = (eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)))) + ((eps * eps) * ((sin(x) / cos(x)) + (pow(sin(x), 3.0) / pow(cos(x), 3.0))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-2.3d-7)) .or. (.not. (eps <= 2.9d-27))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - tan(x)
else
tmp = (eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))) + ((eps * eps) * ((sin(x) / cos(x)) + ((sin(x) ** 3.0d0) / (cos(x) ** 3.0d0))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -2.3e-7) || !(eps <= 2.9e-27)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
} else {
tmp = (eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)))) + ((eps * eps) * ((Math.sin(x) / Math.cos(x)) + (Math.pow(Math.sin(x), 3.0) / Math.pow(Math.cos(x), 3.0))));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -2.3e-7) or not (eps <= 2.9e-27): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) else: tmp = (eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)))) + ((eps * eps) * ((math.sin(x) / math.cos(x)) + (math.pow(math.sin(x), 3.0) / math.pow(math.cos(x), 3.0)))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -2.3e-7) || !(eps <= 2.9e-27)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); else tmp = Float64(Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))) + Float64(Float64(eps * eps) * Float64(Float64(sin(x) / cos(x)) + Float64((sin(x) ^ 3.0) / (cos(x) ^ 3.0))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -2.3e-7) || ~((eps <= 2.9e-27))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); else tmp = (eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))) + ((eps * eps) * ((sin(x) / cos(x)) + ((sin(x) ^ 3.0) / (cos(x) ^ 3.0)))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -2.3e-7], N[Not[LessEqual[eps, 2.9e-27]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(N[(eps + N[(eps * N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * eps), $MachinePrecision] * N[(N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.3 \cdot 10^{-7} \lor \neg \left(\varepsilon \leq 2.9 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\left(\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\end{array}
\end{array}
if eps < -2.29999999999999995e-7 or 2.90000000000000004e-27 < eps Initial program 56.3%
tan-sum99.4%
div-inv99.4%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.4%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
tan-quot99.4%
clear-num99.4%
un-div-inv99.4%
clear-num99.4%
tan-quot99.4%
Applied egg-rr99.4%
if -2.29999999999999995e-7 < eps < 2.90000000000000004e-27Initial program 24.1%
tan-sum24.7%
div-inv24.7%
fma-neg24.7%
Applied egg-rr24.7%
fma-neg24.7%
associate-*r/24.7%
*-rgt-identity24.7%
Simplified24.7%
Taylor expanded in eps around 0 99.6%
mul-1-neg99.6%
unsub-neg99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.5%
(FPCore (x eps) :precision binary64 (if (or (<= eps -5.2e-9) (not (<= eps 2.9e-27))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (/ (tan x) (/ 1.0 (tan eps))))) (tan x)) (+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -5.2e-9) || !(eps <= 2.9e-27)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x);
} else {
tmp = eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-5.2d-9)) .or. (.not. (eps <= 2.9d-27))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - tan(x)
else
tmp = eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -5.2e-9) || !(eps <= 2.9e-27)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
} else {
tmp = eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -5.2e-9) or not (eps <= 2.9e-27): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) else: tmp = eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -5.2e-9) || !(eps <= 2.9e-27)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); else tmp = Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -5.2e-9) || ~((eps <= 2.9e-27))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); else tmp = eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -5.2e-9], N[Not[LessEqual[eps, 2.9e-27]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(eps + N[(eps * 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}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -5.2 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 2.9 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\end{array}
\end{array}
if eps < -5.2000000000000002e-9 or 2.90000000000000004e-27 < eps Initial program 56.0%
tan-sum99.2%
div-inv99.2%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.2%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
tan-quot99.1%
clear-num99.1%
un-div-inv99.1%
clear-num99.2%
tan-quot99.2%
Applied egg-rr99.2%
if -5.2000000000000002e-9 < eps < 2.90000000000000004e-27Initial program 24.3%
Taylor expanded in eps around 0 99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.4%
(FPCore (x eps) :precision binary64 (if (or (<= eps -2.9e-9) (not (<= eps 2.9e-27))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -2.9e-9) || !(eps <= 2.9e-27)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-2.9d-9)) .or. (.not. (eps <= 2.9d-27))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else
tmp = eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -2.9e-9) || !(eps <= 2.9e-27)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else {
tmp = eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -2.9e-9) or not (eps <= 2.9e-27): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) else: tmp = eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -2.9e-9) || !(eps <= 2.9e-27)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); else tmp = Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -2.9e-9) || ~((eps <= 2.9e-27))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x); else tmp = eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -2.9e-9], N[Not[LessEqual[eps, 2.9e-27]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(eps + N[(eps * 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}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.9 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 2.9 \cdot 10^{-27}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\end{array}
\end{array}
if eps < -2.89999999999999991e-9 or 2.90000000000000004e-27 < eps Initial program 56.0%
tan-sum99.2%
div-inv99.2%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.2%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
if -2.89999999999999991e-9 < eps < 2.90000000000000004e-27Initial program 24.3%
Taylor expanded in eps around 0 99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))) (t_1 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -4.8e-9)
(- (* t_0 (/ 1.0 t_1)) (tan x))
(if (<= eps 2.9e-27)
(+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(- (/ t_0 t_1) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double t_1 = 1.0 - (tan(x) * tan(eps));
double tmp;
if (eps <= -4.8e-9) {
tmp = (t_0 * (1.0 / t_1)) - tan(x);
} else if (eps <= 2.9e-27) {
tmp = eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
} else {
tmp = (t_0 / t_1) - 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) :: t_1
real(8) :: tmp
t_0 = tan(x) + tan(eps)
t_1 = 1.0d0 - (tan(x) * tan(eps))
if (eps <= (-4.8d-9)) then
tmp = (t_0 * (1.0d0 / t_1)) - tan(x)
else if (eps <= 2.9d-27) then
tmp = eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
else
tmp = (t_0 / t_1) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.tan(x) + Math.tan(eps);
double t_1 = 1.0 - (Math.tan(x) * Math.tan(eps));
double tmp;
if (eps <= -4.8e-9) {
tmp = (t_0 * (1.0 / t_1)) - Math.tan(x);
} else if (eps <= 2.9e-27) {
tmp = eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = (t_0 / t_1) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.tan(x) + math.tan(eps) t_1 = 1.0 - (math.tan(x) * math.tan(eps)) tmp = 0 if eps <= -4.8e-9: tmp = (t_0 * (1.0 / t_1)) - math.tan(x) elif eps <= 2.9e-27: tmp = eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) else: tmp = (t_0 / t_1) - math.tan(x) return tmp
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) t_1 = Float64(1.0 - Float64(tan(x) * tan(eps))) tmp = 0.0 if (eps <= -4.8e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / t_1)) - tan(x)); elseif (eps <= 2.9e-27) tmp = Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(t_0 / t_1) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = tan(x) + tan(eps); t_1 = 1.0 - (tan(x) * tan(eps)); tmp = 0.0; if (eps <= -4.8e-9) tmp = (t_0 * (1.0 / t_1)) - tan(x); elseif (eps <= 2.9e-27) tmp = eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); else tmp = (t_0 / t_1) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.8e-9], N[(N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 2.9e-27], N[(eps + N[(eps * N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / t$95$1), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
t_1 := 1 - \tan x \cdot \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.8 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 2.9 \cdot 10^{-27}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\end{array}
\end{array}
if eps < -4.8e-9Initial program 51.1%
tan-sum98.9%
div-inv98.9%
Applied egg-rr98.9%
if -4.8e-9 < eps < 2.90000000000000004e-27Initial program 24.3%
Taylor expanded in eps around 0 99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
if 2.90000000000000004e-27 < eps Initial program 60.8%
tan-sum99.4%
div-inv99.4%
fma-neg99.3%
Applied egg-rr99.3%
fma-neg99.4%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(if (<= eps -1.2e-6)
(tan eps)
(if (<= eps 4.8e-5)
(+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -1.2e-6) {
tmp = tan(eps);
} else if (eps <= 4.8e-5) {
tmp = eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
} else {
tmp = tan(eps);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-1.2d-6)) then
tmp = tan(eps)
else if (eps <= 4.8d-5) then
tmp = eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
else
tmp = tan(eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -1.2e-6) {
tmp = Math.tan(eps);
} else if (eps <= 4.8e-5) {
tmp = eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = Math.tan(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -1.2e-6: tmp = math.tan(eps) elif eps <= 4.8e-5: tmp = eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) else: tmp = math.tan(eps) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -1.2e-6) tmp = tan(eps); elseif (eps <= 4.8e-5) tmp = Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); else tmp = tan(eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -1.2e-6) tmp = tan(eps); elseif (eps <= 4.8e-5) tmp = eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -1.2e-6], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 4.8e-5], N[(eps + N[(eps * N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.2 \cdot 10^{-6}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 4.8 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -1.1999999999999999e-6 or 4.8000000000000001e-5 < eps Initial program 55.2%
Taylor expanded in x around 0 58.2%
tan-quot58.4%
expm1-log1p-u45.7%
expm1-udef45.6%
Applied egg-rr45.6%
expm1-def45.7%
expm1-log1p58.4%
Simplified58.4%
if -1.1999999999999999e-6 < eps < 4.8000000000000001e-5Initial program 27.3%
Taylor expanded in eps around 0 98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
distribute-lft-in98.9%
*-rgt-identity98.9%
Simplified98.9%
Final simplification76.1%
(FPCore (x eps)
:precision binary64
(if (<= eps -1.2e-6)
(tan eps)
(if (<= eps 4.4e-5)
(+ eps (* eps (cbrt (pow (pow (tan x) 2.0) 3.0))))
(tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -1.2e-6) {
tmp = tan(eps);
} else if (eps <= 4.4e-5) {
tmp = eps + (eps * cbrt(pow(pow(tan(x), 2.0), 3.0)));
} else {
tmp = tan(eps);
}
return tmp;
}
public static double code(double x, double eps) {
double tmp;
if (eps <= -1.2e-6) {
tmp = Math.tan(eps);
} else if (eps <= 4.4e-5) {
tmp = eps + (eps * Math.cbrt(Math.pow(Math.pow(Math.tan(x), 2.0), 3.0)));
} else {
tmp = Math.tan(eps);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -1.2e-6) tmp = tan(eps); elseif (eps <= 4.4e-5) tmp = Float64(eps + Float64(eps * cbrt(((tan(x) ^ 2.0) ^ 3.0)))); else tmp = tan(eps); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -1.2e-6], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 4.4e-5], N[(eps + N[(eps * N[Power[N[Power[N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision], 3.0], $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.2 \cdot 10^{-6}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \sqrt[3]{{\left({\tan x}^{2}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -1.1999999999999999e-6 or 4.3999999999999999e-5 < eps Initial program 55.2%
Taylor expanded in x around 0 58.2%
tan-quot58.4%
expm1-log1p-u45.7%
expm1-udef45.6%
Applied egg-rr45.6%
expm1-def45.7%
expm1-log1p58.4%
Simplified58.4%
if -1.1999999999999999e-6 < eps < 4.3999999999999999e-5Initial program 27.3%
Taylor expanded in eps around 0 98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
distribute-lft-in98.9%
*-rgt-identity98.9%
Simplified98.9%
add-cbrt-cube98.8%
pow398.8%
unpow298.8%
unpow298.8%
frac-times98.8%
tan-quot98.8%
tan-quot98.9%
pow298.9%
Applied egg-rr98.9%
Final simplification76.1%
(FPCore (x eps) :precision binary64 (if (<= eps -3.5e-6) (tan eps) (if (<= eps 3.5e-5) (* eps (+ (pow (tan x) 2.0) 1.0)) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -3.5e-6) {
tmp = tan(eps);
} else if (eps <= 3.5e-5) {
tmp = eps * (pow(tan(x), 2.0) + 1.0);
} else {
tmp = tan(eps);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-3.5d-6)) then
tmp = tan(eps)
else if (eps <= 3.5d-5) then
tmp = eps * ((tan(x) ** 2.0d0) + 1.0d0)
else
tmp = tan(eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -3.5e-6) {
tmp = Math.tan(eps);
} else if (eps <= 3.5e-5) {
tmp = eps * (Math.pow(Math.tan(x), 2.0) + 1.0);
} else {
tmp = Math.tan(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -3.5e-6: tmp = math.tan(eps) elif eps <= 3.5e-5: tmp = eps * (math.pow(math.tan(x), 2.0) + 1.0) else: tmp = math.tan(eps) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -3.5e-6) tmp = tan(eps); elseif (eps <= 3.5e-5) tmp = Float64(eps * Float64((tan(x) ^ 2.0) + 1.0)); else tmp = tan(eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -3.5e-6) tmp = tan(eps); elseif (eps <= 3.5e-5) tmp = eps * ((tan(x) ^ 2.0) + 1.0); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -3.5e-6], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 3.5e-5], N[(eps * N[(N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.5 \cdot 10^{-6}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 3.5 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon \cdot \left({\tan x}^{2} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -3.49999999999999995e-6 or 3.4999999999999997e-5 < eps Initial program 55.2%
Taylor expanded in x around 0 58.2%
tan-quot58.4%
expm1-log1p-u45.7%
expm1-udef45.6%
Applied egg-rr45.6%
expm1-def45.7%
expm1-log1p58.4%
Simplified58.4%
if -3.49999999999999995e-6 < eps < 3.4999999999999997e-5Initial program 27.3%
tan-sum28.6%
div-inv28.5%
fma-neg28.6%
Applied egg-rr28.6%
fma-neg28.5%
associate-*r/28.6%
*-rgt-identity28.6%
Simplified28.6%
clear-num28.3%
associate-/r/28.5%
fma-neg28.6%
Applied egg-rr28.6%
Taylor expanded in eps around 0 98.8%
expm1-log1p-u98.7%
expm1-udef98.7%
unpow298.7%
unpow298.7%
frac-times98.6%
tan-quot98.7%
tan-quot98.8%
pow298.8%
Applied egg-rr98.8%
expm1-def98.8%
expm1-log1p98.9%
Simplified98.9%
Final simplification76.1%
(FPCore (x eps) :precision binary64 (if (<= eps -4.5e-6) (tan eps) (if (<= eps 3.2e-5) (+ eps (* eps (pow (tan x) 2.0))) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -4.5e-6) {
tmp = tan(eps);
} else if (eps <= 3.2e-5) {
tmp = eps + (eps * pow(tan(x), 2.0));
} else {
tmp = tan(eps);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-4.5d-6)) then
tmp = tan(eps)
else if (eps <= 3.2d-5) then
tmp = eps + (eps * (tan(x) ** 2.0d0))
else
tmp = tan(eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -4.5e-6) {
tmp = Math.tan(eps);
} else if (eps <= 3.2e-5) {
tmp = eps + (eps * Math.pow(Math.tan(x), 2.0));
} else {
tmp = Math.tan(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -4.5e-6: tmp = math.tan(eps) elif eps <= 3.2e-5: tmp = eps + (eps * math.pow(math.tan(x), 2.0)) else: tmp = math.tan(eps) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -4.5e-6) tmp = tan(eps); elseif (eps <= 3.2e-5) tmp = Float64(eps + Float64(eps * (tan(x) ^ 2.0))); else tmp = tan(eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -4.5e-6) tmp = tan(eps); elseif (eps <= 3.2e-5) tmp = eps + (eps * (tan(x) ^ 2.0)); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -4.5e-6], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 3.2e-5], N[(eps + N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -4.5 \cdot 10^{-6}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 3.2 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\tan x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -4.50000000000000011e-6 or 3.19999999999999986e-5 < eps Initial program 55.2%
Taylor expanded in x around 0 58.2%
tan-quot58.4%
expm1-log1p-u45.7%
expm1-udef45.6%
Applied egg-rr45.6%
expm1-def45.7%
expm1-log1p58.4%
Simplified58.4%
if -4.50000000000000011e-6 < eps < 3.19999999999999986e-5Initial program 27.3%
Taylor expanded in eps around 0 98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
distribute-lft-in98.9%
*-rgt-identity98.9%
Simplified98.9%
expm1-log1p-u98.9%
expm1-udef59.7%
unpow259.7%
unpow259.7%
frac-times59.7%
tan-quot59.7%
tan-quot59.7%
pow259.7%
Applied egg-rr59.7%
expm1-def98.9%
expm1-log1p98.9%
Simplified98.9%
Final simplification76.1%
(FPCore (x eps) :precision binary64 (tan eps))
double code(double x, double eps) {
return tan(eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan(eps)
end function
public static double code(double x, double eps) {
return Math.tan(eps);
}
def code(x, eps): return math.tan(eps)
function code(x, eps) return tan(eps) end
function tmp = code(x, eps) tmp = tan(eps); end
code[x_, eps_] := N[Tan[eps], $MachinePrecision]
\begin{array}{l}
\\
\tan \varepsilon
\end{array}
Initial program 43.0%
Taylor expanded in x around 0 58.6%
tan-quot58.7%
expm1-log1p-u51.6%
expm1-udef28.4%
Applied egg-rr28.4%
expm1-def51.6%
expm1-log1p58.7%
Simplified58.7%
Final simplification58.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 43.0%
Taylor expanded in x around 0 58.6%
Taylor expanded in eps around 0 27.7%
Final simplification27.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 2023238
(FPCore (x eps)
:name "2tan (problem 3.3.2)"
:precision binary64
:herbie-target
(/ (sin eps) (* (cos x) (cos (+ x eps))))
(- (tan (+ x eps)) (tan x)))