
(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
(if (<= eps -1.5e-7)
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps))))))
(tan x))
(if (<= eps 1.55e-7)
(+
(+ 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)))))
(-
(/
(- (- (tan x)) (tan eps))
(fma (tan x) (/ (- (sin eps)) (- (cos eps))) -1.0))
(tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -1.5e-7) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else if (eps <= 1.55e-7) {
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))));
} else {
tmp = ((-tan(x) - tan(eps)) / fma(tan(x), (-sin(eps) / -cos(eps)), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -1.5e-7) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); elseif (eps <= 1.55e-7) 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))))); else tmp = Float64(Float64(Float64(Float64(-tan(x)) - tan(eps)) / fma(tan(x), Float64(Float64(-sin(eps)) / Float64(-cos(eps))), -1.0)) - tan(x)); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -1.5e-7], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[(-1.0 / N[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.55e-7], 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], N[(N[(N[((-N[Tan[x], $MachinePrecision]) - N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(N[Tan[x], $MachinePrecision] * N[((-N[Sin[eps], $MachinePrecision]) / (-N[Cos[eps], $MachinePrecision])), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 1.55 \cdot 10^{-7}:\\
\;\;\;\;\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)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-\tan x\right) - \tan \varepsilon}{\mathsf{fma}\left(\tan x, \frac{-\sin \varepsilon}{-\cos \varepsilon}, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -1.4999999999999999e-7Initial program 54.0%
tan-sum99.5%
div-inv99.5%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
tan-quot99.5%
clear-num99.6%
un-div-inv99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
Simplified99.5%
if -1.4999999999999999e-7 < eps < 1.55e-7Initial program 29.8%
tan-sum31.2%
div-inv31.2%
fma-neg31.2%
Applied egg-rr31.2%
fma-neg31.2%
associate-*r/31.2%
*-rgt-identity31.2%
Simplified31.2%
*-commutative31.2%
tan-quot31.2%
clear-num31.2%
tan-quot31.2%
frac-times31.2%
*-un-lft-identity31.2%
clear-num31.2%
tan-quot31.2%
Applied egg-rr31.2%
*-commutative31.2%
associate-*r/31.2%
*-rgt-identity31.2%
Simplified31.2%
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%
unpow299.7%
Simplified99.7%
if 1.55e-7 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
frac-2neg99.5%
distribute-frac-neg99.5%
sub-neg99.5%
distribute-neg-in99.5%
metadata-eval99.5%
distribute-lft-neg-in99.5%
add-sqr-sqrt56.1%
sqrt-unprod84.5%
sqr-neg84.5%
sqrt-unprod28.4%
add-sqr-sqrt61.3%
distribute-lft-neg-in61.3%
add-sqr-sqrt32.9%
sqrt-unprod76.3%
sqr-neg76.3%
sqrt-unprod43.3%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
+-commutative99.5%
fma-def99.5%
Simplified99.5%
tan-quot99.6%
frac-2neg99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (<= eps -2.65e-7)
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps))))))
(tan x))
(if (<= eps 4.5e-8)
(+
(+ 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)))))
(-
(/
(- (- (tan x)) (tan eps))
(fma (tan x) (/ (- (sin eps)) (- (cos eps))) -1.0))
(tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -2.65e-7) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else if (eps <= 4.5e-8) {
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))));
} else {
tmp = ((-tan(x) - tan(eps)) / fma(tan(x), (-sin(eps) / -cos(eps)), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -2.65e-7) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); elseif (eps <= 4.5e-8) 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))))); else tmp = Float64(Float64(Float64(Float64(-tan(x)) - tan(eps)) / fma(tan(x), Float64(Float64(-sin(eps)) / Float64(-cos(eps))), -1.0)) - tan(x)); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -2.65e-7], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[(-1.0 / N[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.5e-8], 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], N[(N[(N[((-N[Tan[x], $MachinePrecision]) - N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(N[Tan[x], $MachinePrecision] * N[((-N[Sin[eps], $MachinePrecision]) / (-N[Cos[eps], $MachinePrecision])), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.65 \cdot 10^{-7}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.5 \cdot 10^{-8}:\\
\;\;\;\;\left(\varepsilon + \varepsilon \cdot \left({\sin x}^{2} \cdot {\cos x}^{-2}\right)\right) + \left(\varepsilon \cdot \varepsilon\right) \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-\tan x\right) - \tan \varepsilon}{\mathsf{fma}\left(\tan x, \frac{-\sin \varepsilon}{-\cos \varepsilon}, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -2.65e-7Initial program 54.0%
tan-sum99.5%
div-inv99.5%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
tan-quot99.5%
clear-num99.6%
un-div-inv99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
frac-2neg99.5%
div-inv99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
metadata-eval99.5%
Simplified99.5%
if -2.65e-7 < eps < 4.49999999999999993e-8Initial program 29.8%
tan-sum31.2%
div-inv31.2%
fma-neg31.2%
Applied egg-rr31.2%
fma-neg31.2%
associate-*r/31.2%
*-rgt-identity31.2%
Simplified31.2%
Taylor expanded in eps around 0 99.6%
Simplified99.7%
if 4.49999999999999993e-8 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
frac-2neg99.5%
distribute-frac-neg99.5%
sub-neg99.5%
distribute-neg-in99.5%
metadata-eval99.5%
distribute-lft-neg-in99.5%
add-sqr-sqrt56.1%
sqrt-unprod84.5%
sqr-neg84.5%
sqrt-unprod28.4%
add-sqr-sqrt61.3%
distribute-lft-neg-in61.3%
add-sqr-sqrt32.9%
sqrt-unprod76.3%
sqr-neg76.3%
sqrt-unprod43.3%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
+-commutative99.5%
fma-def99.5%
Simplified99.5%
tan-quot99.6%
frac-2neg99.6%
Applied egg-rr99.6%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(if (<= eps -5e-9)
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps))))))
(tan x))
(if (<= eps 4.4e-9)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(-
(/
(- (- (tan x)) (tan eps))
(fma (tan x) (/ (- (sin eps)) (- (cos eps))) -1.0))
(tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -5e-9) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else if (eps <= 4.4e-9) {
tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / pow(cos(x), 2.0)));
} else {
tmp = ((-tan(x) - tan(eps)) / fma(tan(x), (-sin(eps) / -cos(eps)), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -5e-9) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); elseif (eps <= 4.4e-9) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(Float64(Float64(-tan(x)) - tan(eps)) / fma(tan(x), Float64(Float64(-sin(eps)) / Float64(-cos(eps))), -1.0)) - tan(x)); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -5e-9], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[(-1.0 / N[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.4e-9], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[((-N[Tan[x], $MachinePrecision]) - N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(N[Tan[x], $MachinePrecision] * N[((-N[Sin[eps], $MachinePrecision]) / (-N[Cos[eps], $MachinePrecision])), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-\tan x\right) - \tan \varepsilon}{\mathsf{fma}\left(\tan x, \frac{-\sin \varepsilon}{-\cos \varepsilon}, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -5.0000000000000001e-9Initial program 53.2%
tan-sum99.0%
div-inv99.0%
fma-neg98.9%
Applied egg-rr98.9%
fma-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
tan-quot99.0%
clear-num99.1%
un-div-inv99.0%
clear-num99.0%
tan-quot99.0%
Applied egg-rr99.0%
frac-2neg99.0%
div-inv99.0%
Applied egg-rr99.0%
distribute-neg-frac99.0%
metadata-eval99.0%
Simplified99.0%
if -5.0000000000000001e-9 < eps < 4.3999999999999997e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
if 4.3999999999999997e-9 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
frac-2neg99.5%
distribute-frac-neg99.5%
sub-neg99.5%
distribute-neg-in99.5%
metadata-eval99.5%
distribute-lft-neg-in99.5%
add-sqr-sqrt56.1%
sqrt-unprod84.5%
sqr-neg84.5%
sqrt-unprod28.4%
add-sqr-sqrt61.3%
distribute-lft-neg-in61.3%
add-sqr-sqrt32.9%
sqrt-unprod76.3%
sqr-neg76.3%
sqrt-unprod43.3%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
+-commutative99.5%
fma-def99.5%
Simplified99.5%
tan-quot99.6%
frac-2neg99.6%
Applied egg-rr99.6%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -4.7e-9)
(- (/ t_0 (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps)))))) (tan x))
(if (<= eps 3.5e-9)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(- (- (tan x)) (/ t_0 (fma (tan x) (/ 1.0 (/ 1.0 (tan eps))) -1.0)))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -4.7e-9) {
tmp = (t_0 / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else if (eps <= 3.5e-9) {
tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / pow(cos(x), 2.0)));
} else {
tmp = -tan(x) - (t_0 / fma(tan(x), (1.0 / (1.0 / tan(eps))), -1.0));
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -4.7e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); elseif (eps <= 3.5e-9) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(-tan(x)) - Float64(t_0 / fma(tan(x), Float64(1.0 / Float64(1.0 / tan(eps))), -1.0))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.7e-9], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[(-1.0 / N[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.5e-9], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Tan[x], $MachinePrecision]) - N[(t$95$0 / N[(N[Tan[x], $MachinePrecision] * N[(1.0 / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.5 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(-\tan x\right) - \frac{t_0}{\mathsf{fma}\left(\tan x, \frac{1}{\frac{1}{\tan \varepsilon}}, -1\right)}\\
\end{array}
\end{array}
if eps < -4.6999999999999999e-9Initial program 53.2%
tan-sum99.0%
div-inv99.0%
fma-neg98.9%
Applied egg-rr98.9%
fma-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
tan-quot99.0%
clear-num99.1%
un-div-inv99.0%
clear-num99.0%
tan-quot99.0%
Applied egg-rr99.0%
frac-2neg99.0%
div-inv99.0%
Applied egg-rr99.0%
distribute-neg-frac99.0%
metadata-eval99.0%
Simplified99.0%
if -4.6999999999999999e-9 < eps < 3.4999999999999999e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
if 3.4999999999999999e-9 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
frac-2neg99.5%
distribute-frac-neg99.5%
sub-neg99.5%
distribute-neg-in99.5%
metadata-eval99.5%
distribute-lft-neg-in99.5%
add-sqr-sqrt56.1%
sqrt-unprod84.5%
sqr-neg84.5%
sqrt-unprod28.4%
add-sqr-sqrt61.3%
distribute-lft-neg-in61.3%
add-sqr-sqrt32.9%
sqrt-unprod76.3%
sqr-neg76.3%
sqrt-unprod43.3%
add-sqr-sqrt99.5%
Applied egg-rr99.5%
distribute-neg-frac99.5%
+-commutative99.5%
fma-def99.5%
Simplified99.5%
remove-double-div99.5%
Applied egg-rr99.5%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -3.7e-9)
(- (/ t_0 (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps)))))) (tan x))
(if (<= eps 4.4e-9)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(- (/ t_0 (- 1.0 (* (sin x) (/ (tan eps) (cos x))))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -3.7e-9) {
tmp = (t_0 / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else if (eps <= 4.4e-9) {
tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / pow(cos(x), 2.0)));
} else {
tmp = (t_0 / (1.0 - (sin(x) * (tan(eps) / cos(x))))) - 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(x) + tan(eps)
if (eps <= (-3.7d-9)) then
tmp = (t_0 / (1.0d0 - (tan(x) * ((-1.0d0) / ((-1.0d0) / tan(eps)))))) - tan(x)
else if (eps <= 4.4d-9) then
tmp = eps + (eps * ((0.5d0 - (cos((x + x)) / 2.0d0)) / (cos(x) ** 2.0d0)))
else
tmp = (t_0 / (1.0d0 - (sin(x) * (tan(eps) / cos(x))))) - 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 tmp;
if (eps <= -3.7e-9) {
tmp = (t_0 / (1.0 - (Math.tan(x) * (-1.0 / (-1.0 / Math.tan(eps)))))) - Math.tan(x);
} else if (eps <= 4.4e-9) {
tmp = eps + (eps * ((0.5 - (Math.cos((x + x)) / 2.0)) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = (t_0 / (1.0 - (Math.sin(x) * (Math.tan(eps) / Math.cos(x))))) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.tan(x) + math.tan(eps) tmp = 0 if eps <= -3.7e-9: tmp = (t_0 / (1.0 - (math.tan(x) * (-1.0 / (-1.0 / math.tan(eps)))))) - math.tan(x) elif eps <= 4.4e-9: tmp = eps + (eps * ((0.5 - (math.cos((x + x)) / 2.0)) / math.pow(math.cos(x), 2.0))) else: tmp = (t_0 / (1.0 - (math.sin(x) * (math.tan(eps) / math.cos(x))))) - math.tan(x) return tmp
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -3.7e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); elseif (eps <= 4.4e-9) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(sin(x) * Float64(tan(eps) / cos(x))))) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = tan(x) + tan(eps); tmp = 0.0; if (eps <= -3.7e-9) tmp = (t_0 / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x); elseif (eps <= 4.4e-9) tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); else tmp = (t_0 / (1.0 - (sin(x) * (tan(eps) / cos(x))))) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -3.7e-9], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[(-1.0 / N[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.4e-9], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(1.0 - N[(N[Sin[x], $MachinePrecision] * N[(N[Tan[eps], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -3.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \sin x \cdot \frac{\tan \varepsilon}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -3.7e-9Initial program 53.2%
tan-sum99.0%
div-inv99.0%
fma-neg98.9%
Applied egg-rr98.9%
fma-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
tan-quot99.0%
clear-num99.1%
un-div-inv99.0%
clear-num99.0%
tan-quot99.0%
Applied egg-rr99.0%
frac-2neg99.0%
div-inv99.0%
Applied egg-rr99.0%
distribute-neg-frac99.0%
metadata-eval99.0%
Simplified99.0%
if -3.7e-9 < eps < 4.3999999999999997e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
if 4.3999999999999997e-9 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.4%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
div-inv99.5%
clear-num99.5%
Applied egg-rr99.5%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(if (or (<= eps -4.2e-9) (not (<= eps 4.4e-9)))
(-
(/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (/ -1.0 (/ -1.0 (tan eps))))))
(tan x))
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -4.2e-9) || !(eps <= 4.4e-9)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x);
} else {
tmp = eps + (eps * ((0.5 - (cos((x + 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 <= (-4.2d-9)) .or. (.not. (eps <= 4.4d-9))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * ((-1.0d0) / ((-1.0d0) / tan(eps)))))) - tan(x)
else
tmp = eps + (eps * ((0.5d0 - (cos((x + 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 <= -4.2e-9) || !(eps <= 4.4e-9)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) * (-1.0 / (-1.0 / Math.tan(eps)))))) - Math.tan(x);
} else {
tmp = eps + (eps * ((0.5 - (Math.cos((x + x)) / 2.0)) / Math.pow(Math.cos(x), 2.0)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -4.2e-9) or not (eps <= 4.4e-9): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) * (-1.0 / (-1.0 / math.tan(eps)))))) - math.tan(x) else: tmp = eps + (eps * ((0.5 - (math.cos((x + x)) / 2.0)) / math.pow(math.cos(x), 2.0))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -4.2e-9) || !(eps <= 4.4e-9)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * Float64(-1.0 / Float64(-1.0 / tan(eps)))))) - tan(x)); else tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -4.2e-9) || ~((eps <= 4.4e-9))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * (-1.0 / (-1.0 / tan(eps)))))) - tan(x); else tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -4.2e-9], N[Not[LessEqual[eps, 4.4e-9]], $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[(-1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -4.2 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 4.4 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \frac{-1}{\frac{-1}{\tan \varepsilon}}} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\end{array}
\end{array}
if eps < -4.20000000000000039e-9 or 4.3999999999999997e-9 < eps Initial program 55.9%
tan-sum99.2%
div-inv99.1%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.1%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
tan-quot99.3%
clear-num99.3%
un-div-inv99.2%
clear-num99.2%
tan-quot99.2%
Applied egg-rr99.2%
frac-2neg99.2%
div-inv99.3%
Applied egg-rr99.3%
distribute-neg-frac99.3%
metadata-eval99.3%
Simplified99.3%
if -4.20000000000000039e-9 < eps < 4.3999999999999997e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -5e-9)
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))
(if (<= eps 5.2e-9)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(- (/ t_0 (- 1.0 (/ (tan x) (/ 1.0 (tan eps))))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -5e-9) {
tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else if (eps <= 5.2e-9) {
tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / pow(cos(x), 2.0)));
} else {
tmp = (t_0 / (1.0 - (tan(x) / (1.0 / tan(eps))))) - 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(x) + tan(eps)
if (eps <= (-5d-9)) then
tmp = (t_0 / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else if (eps <= 5.2d-9) then
tmp = eps + (eps * ((0.5d0 - (cos((x + x)) / 2.0d0)) / (cos(x) ** 2.0d0)))
else
tmp = (t_0 / (1.0d0 - (tan(x) / (1.0d0 / tan(eps))))) - 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 tmp;
if (eps <= -5e-9) {
tmp = (t_0 / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else if (eps <= 5.2e-9) {
tmp = eps + (eps * ((0.5 - (Math.cos((x + x)) / 2.0)) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = (t_0 / (1.0 - (Math.tan(x) / (1.0 / Math.tan(eps))))) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.tan(x) + math.tan(eps) tmp = 0 if eps <= -5e-9: tmp = (t_0 / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) elif eps <= 5.2e-9: tmp = eps + (eps * ((0.5 - (math.cos((x + x)) / 2.0)) / math.pow(math.cos(x), 2.0))) else: tmp = (t_0 / (1.0 - (math.tan(x) / (1.0 / math.tan(eps))))) - math.tan(x) return tmp
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -5e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); elseif (eps <= 5.2e-9) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) / Float64(1.0 / tan(eps))))) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = tan(x) + tan(eps); tmp = 0.0; if (eps <= -5e-9) tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x); elseif (eps <= 5.2e-9) tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); else tmp = (t_0 / (1.0 - (tan(x) / (1.0 / tan(eps))))) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -5e-9], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 5.2e-9], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(1.0 / N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -5 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\end{array}
\end{array}
if eps < -5.0000000000000001e-9Initial program 53.2%
tan-sum99.0%
div-inv99.0%
fma-neg98.9%
Applied egg-rr98.9%
fma-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
if -5.0000000000000001e-9 < eps < 5.2000000000000002e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
if 5.2000000000000002e-9 < eps Initial program 58.9%
tan-sum99.5%
div-inv99.3%
fma-neg99.4%
Applied egg-rr99.4%
fma-neg99.3%
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%
Final simplification99.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -3.7e-9) (not (<= eps 3.6e-9))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -3.7e-9) || !(eps <= 3.6e-9)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = eps + (eps * ((0.5 - (cos((x + 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 <= (-3.7d-9)) .or. (.not. (eps <= 3.6d-9))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else
tmp = eps + (eps * ((0.5d0 - (cos((x + 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 <= -3.7e-9) || !(eps <= 3.6e-9)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else {
tmp = eps + (eps * ((0.5 - (Math.cos((x + x)) / 2.0)) / Math.pow(Math.cos(x), 2.0)));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -3.7e-9) or not (eps <= 3.6e-9): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) else: tmp = eps + (eps * ((0.5 - (math.cos((x + x)) / 2.0)) / math.pow(math.cos(x), 2.0))) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -3.7e-9) || !(eps <= 3.6e-9)) 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(Float64(0.5 - Float64(cos(Float64(x + x)) / 2.0)) / (cos(x) ^ 2.0)))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -3.7e-9) || ~((eps <= 3.6e-9))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x); else tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -3.7e-9], N[Not[LessEqual[eps, 3.6e-9]], $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[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.7 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 3.6 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\end{array}
\end{array}
if eps < -3.7e-9 or 3.6e-9 < eps Initial program 55.9%
tan-sum99.2%
div-inv99.1%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.1%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
if -3.7e-9 < eps < 3.6e-9Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(if (<= eps -5.5e-9)
(-
(/
(+ (tan x) (tan eps))
(- 1.0 (/ (tan x) (+ (/ 1.0 eps) (* eps -0.3333333333333333)))))
(tan x))
(if (<= eps 5.2e-7)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -5.5e-9) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / ((1.0 / eps) + (eps * -0.3333333333333333))))) - tan(x);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps * ((0.5 - (cos((x + 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 <= (-5.5d-9)) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) / ((1.0d0 / eps) + (eps * (-0.3333333333333333d0)))))) - tan(x)
else if (eps <= 5.2d-7) then
tmp = eps + (eps * ((0.5d0 - (cos((x + 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 <= -5.5e-9) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) / ((1.0 / eps) + (eps * -0.3333333333333333))))) - Math.tan(x);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps * ((0.5 - (Math.cos((x + 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 <= -5.5e-9: tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) / ((1.0 / eps) + (eps * -0.3333333333333333))))) - math.tan(x) elif eps <= 5.2e-7: tmp = eps + (eps * ((0.5 - (math.cos((x + 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 <= -5.5e-9) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) / Float64(Float64(1.0 / eps) + Float64(eps * -0.3333333333333333))))) - tan(x)); elseif (eps <= 5.2e-7) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + 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 <= -5.5e-9) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) / ((1.0 / eps) + (eps * -0.3333333333333333))))) - tan(x); elseif (eps <= 5.2e-7) tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -5.5e-9], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[x], $MachinePrecision] / N[(N[(1.0 / eps), $MachinePrecision] + N[(eps * -0.3333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 5.2e-7], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $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 -5.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \frac{\tan x}{\frac{1}{\varepsilon} + \varepsilon \cdot -0.3333333333333333}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -5.4999999999999996e-9Initial program 53.2%
tan-sum99.0%
div-inv99.0%
fma-neg98.9%
Applied egg-rr98.9%
fma-neg99.0%
associate-*r/99.0%
*-rgt-identity99.0%
Simplified99.0%
tan-quot99.0%
clear-num99.1%
un-div-inv99.0%
clear-num99.0%
tan-quot99.0%
Applied egg-rr99.0%
Taylor expanded in eps around 0 58.8%
*-commutative58.8%
Simplified58.8%
if -5.4999999999999996e-9 < eps < 5.19999999999999998e-7Initial program 30.0%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
distribute-lft-in99.3%
*-rgt-identity99.3%
Simplified99.3%
unpow299.3%
sin-mult99.3%
Applied egg-rr99.3%
div-sub99.3%
+-inverses99.3%
cos-099.3%
metadata-eval99.3%
Simplified99.3%
if 5.19999999999999998e-7 < eps Initial program 58.9%
Taylor expanded in x around 0 61.4%
tan-quot61.7%
expm1-log1p-u46.5%
expm1-udef45.5%
Applied egg-rr45.5%
expm1-def46.5%
expm1-log1p61.7%
Simplified61.7%
Final simplification79.1%
(FPCore (x eps)
:precision binary64
(if (<= eps -0.062)
(tan eps)
(if (<= eps 5.2e-7)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.062) {
tmp = tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps * ((0.5 - (cos((x + 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 <= (-0.062d0)) then
tmp = tan(eps)
else if (eps <= 5.2d-7) then
tmp = eps + (eps * ((0.5d0 - (cos((x + 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 <= -0.062) {
tmp = Math.tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps * ((0.5 - (Math.cos((x + 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 <= -0.062: tmp = math.tan(eps) elif eps <= 5.2e-7: tmp = eps + (eps * ((0.5 - (math.cos((x + 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 <= -0.062) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = Float64(eps + Float64(eps * Float64(Float64(0.5 - Float64(cos(Float64(x + 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 <= -0.062) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.062], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 5.2e-7], N[(eps + N[(eps * N[(N[(0.5 - N[(N[Cos[N[(x + x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $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 -0.062:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.062 or 5.19999999999999998e-7 < eps Initial program 56.7%
Taylor expanded in x around 0 59.9%
tan-quot60.2%
expm1-log1p-u43.8%
expm1-udef43.2%
Applied egg-rr43.2%
expm1-def43.8%
expm1-log1p60.2%
Simplified60.2%
if -0.062 < eps < 5.19999999999999998e-7Initial program 29.6%
Taylor expanded in eps around 0 98.3%
cancel-sign-sub-inv98.3%
metadata-eval98.3%
*-lft-identity98.3%
distribute-lft-in98.3%
*-rgt-identity98.3%
Simplified98.3%
unpow298.3%
sin-mult98.4%
Applied egg-rr98.4%
div-sub98.4%
+-inverses98.4%
cos-098.4%
metadata-eval98.4%
Simplified98.4%
Final simplification79.0%
(FPCore (x eps) :precision binary64 (if (<= eps -0.062) (tan eps) (if (<= eps 5.2e-7) (+ eps (/ eps (/ 1.0 (pow (tan x) 2.0)))) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.062) {
tmp = tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps / (1.0 / 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 <= (-0.062d0)) then
tmp = tan(eps)
else if (eps <= 5.2d-7) then
tmp = eps + (eps / (1.0d0 / (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 <= -0.062) {
tmp = Math.tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps + (eps / (1.0 / Math.pow(Math.tan(x), 2.0)));
} else {
tmp = Math.tan(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -0.062: tmp = math.tan(eps) elif eps <= 5.2e-7: tmp = eps + (eps / (1.0 / math.pow(math.tan(x), 2.0))) else: tmp = math.tan(eps) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -0.062) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = Float64(eps + Float64(eps / Float64(1.0 / (tan(x) ^ 2.0)))); else tmp = tan(eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -0.062) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = eps + (eps / (1.0 / (tan(x) ^ 2.0))); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.062], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 5.2e-7], N[(eps + N[(eps / N[(1.0 / N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.062:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \frac{\varepsilon}{\frac{1}{{\tan x}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.062 or 5.19999999999999998e-7 < eps Initial program 56.7%
Taylor expanded in x around 0 59.9%
tan-quot60.2%
expm1-log1p-u43.8%
expm1-udef43.2%
Applied egg-rr43.2%
expm1-def43.8%
expm1-log1p60.2%
Simplified60.2%
if -0.062 < eps < 5.19999999999999998e-7Initial program 29.6%
Taylor expanded in eps around 0 98.3%
cancel-sign-sub-inv98.3%
metadata-eval98.3%
*-lft-identity98.3%
distribute-lft-in98.3%
*-rgt-identity98.3%
Simplified98.3%
clear-num98.3%
un-div-inv98.3%
clear-num98.3%
unpow298.3%
unpow298.3%
frac-times98.3%
tan-quot98.3%
tan-quot98.3%
pow298.3%
Applied egg-rr98.3%
Final simplification79.0%
(FPCore (x eps) :precision binary64 (if (<= eps -0.062) (tan eps) (if (<= eps 4.6e-7) (+ eps (* eps (pow (tan x) 2.0))) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.062) {
tmp = tan(eps);
} else if (eps <= 4.6e-7) {
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 <= (-0.062d0)) then
tmp = tan(eps)
else if (eps <= 4.6d-7) 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 <= -0.062) {
tmp = Math.tan(eps);
} else if (eps <= 4.6e-7) {
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 <= -0.062: tmp = math.tan(eps) elif eps <= 4.6e-7: 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 <= -0.062) tmp = tan(eps); elseif (eps <= 4.6e-7) 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 <= -0.062) tmp = tan(eps); elseif (eps <= 4.6e-7) tmp = eps + (eps * (tan(x) ^ 2.0)); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.062], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 4.6e-7], 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 -0.062:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 4.6 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\tan x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.062 or 4.5999999999999999e-7 < eps Initial program 56.7%
Taylor expanded in x around 0 59.9%
tan-quot60.2%
expm1-log1p-u43.8%
expm1-udef43.2%
Applied egg-rr43.2%
expm1-def43.8%
expm1-log1p60.2%
Simplified60.2%
if -0.062 < eps < 4.5999999999999999e-7Initial program 29.6%
Taylor expanded in eps around 0 98.3%
cancel-sign-sub-inv98.3%
metadata-eval98.3%
*-lft-identity98.3%
distribute-lft-in98.3%
*-rgt-identity98.3%
Simplified98.3%
expm1-log1p-u98.3%
expm1-udef61.6%
unpow261.6%
unpow261.6%
frac-times61.6%
tan-quot61.6%
tan-quot61.6%
pow261.6%
Applied egg-rr61.6%
expm1-def98.3%
expm1-log1p98.3%
Simplified98.3%
Final simplification79.0%
(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.4%
Taylor expanded in x around 0 60.3%
tan-quot60.5%
expm1-log1p-u52.1%
expm1-udef24.9%
Applied egg-rr24.9%
expm1-def52.1%
expm1-log1p60.5%
Simplified60.5%
Final simplification60.5%
(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.4%
Taylor expanded in x around 0 60.3%
Taylor expanded in eps around 0 32.0%
Final simplification32.0%
(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 2023257
(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)))