
(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 11 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 (or (<= eps -2.8e-7) (not (<= eps 2.2e-7)))
(fma
(+ (tan x) (tan eps))
(/ 1.0 (- 1.0 (* (tan x) (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.8e-7) || !(eps <= 2.2e-7)) {
tmp = fma((tan(x) + tan(eps)), (1.0 / (1.0 - (tan(x) * 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;
}
function code(x, eps) tmp = 0.0 if ((eps <= -2.8e-7) || !(eps <= 2.2e-7)) tmp = fma(Float64(tan(x) + tan(eps)), Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), Float64(-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
code[x_, eps_] := If[Or[LessEqual[eps, -2.8e-7], N[Not[LessEqual[eps, 2.2e-7]], $MachinePrecision]], N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $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.8 \cdot 10^{-7} \lor \neg \left(\varepsilon \leq 2.2 \cdot 10^{-7}\right):\\
\;\;\;\;\mathsf{fma}\left(\tan x + \tan \varepsilon, \frac{1}{1 - \tan x \cdot \tan \varepsilon}, -\tan x\right)\\
\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.80000000000000019e-7 or 2.2000000000000001e-7 < eps Initial program 56.3%
tan-sum99.6%
div-inv99.5%
fma-neg99.6%
Applied egg-rr99.6%
if -2.80000000000000019e-7 < eps < 2.2000000000000001e-7Initial program 27.5%
tan-sum27.9%
div-inv27.9%
fma-neg27.9%
Applied egg-rr27.9%
fma-neg27.9%
associate-*r/27.9%
*-rgt-identity27.9%
Simplified27.9%
Taylor expanded in eps around 0 99.7%
mul-1-neg99.7%
unsub-neg99.7%
cancel-sign-sub-inv99.7%
metadata-eval99.7%
*-lft-identity99.7%
distribute-lft-in99.7%
*-rgt-identity99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x eps)
:precision binary64
(if (or (<= eps -3.6e-9) (not (<= eps 4.4e-9)))
(fma
(+ (tan x) (tan eps))
(/ 1.0 (- 1.0 (* (tan x) (tan eps))))
(- (tan x)))
(+ eps (* eps (pow (* (sin x) (sqrt (pow (cos x) -2.0))) 2.0)))))
double code(double x, double eps) {
double tmp;
if ((eps <= -3.6e-9) || !(eps <= 4.4e-9)) {
tmp = fma((tan(x) + tan(eps)), (1.0 / (1.0 - (tan(x) * tan(eps)))), -tan(x));
} else {
tmp = eps + (eps * pow((sin(x) * sqrt(pow(cos(x), -2.0))), 2.0));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if ((eps <= -3.6e-9) || !(eps <= 4.4e-9)) tmp = fma(Float64(tan(x) + tan(eps)), Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), Float64(-tan(x))); else tmp = Float64(eps + Float64(eps * (Float64(sin(x) * sqrt((cos(x) ^ -2.0))) ^ 2.0))); end return tmp end
code[x_, eps_] := If[Or[LessEqual[eps, -3.6e-9], N[Not[LessEqual[eps, 4.4e-9]], $MachinePrecision]], N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] * N[(1.0 / 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[Power[N[(N[Sin[x], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.6 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 4.4 \cdot 10^{-9}\right):\\
\;\;\;\;\mathsf{fma}\left(\tan x + \tan \varepsilon, \frac{1}{1 - \tan x \cdot \tan \varepsilon}, -\tan x\right)\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\left(\sin x \cdot \sqrt{{\cos x}^{-2}}\right)}^{2}\\
\end{array}
\end{array}
if eps < -3.6e-9 or 4.3999999999999997e-9 < eps Initial program 56.3%
tan-sum99.6%
div-inv99.5%
fma-neg99.6%
Applied egg-rr99.6%
if -3.6e-9 < eps < 4.3999999999999997e-9Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
add-sqr-sqrt99.4%
pow299.4%
div-inv99.4%
sqrt-prod99.5%
unpow299.5%
sqrt-prod47.9%
add-sqr-sqrt99.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -4.5e-9)
(- (* t_0 (/ 1.0 (- 1.0 (* (tan x) (tan eps))))) (tan x))
(if (<= eps 4.5e-9)
(+ eps (* eps (pow (* (sin x) (sqrt (pow (cos x) -2.0))) 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 <= -4.5e-9) {
tmp = (t_0 * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x);
} else if (eps <= 4.5e-9) {
tmp = eps + (eps * pow((sin(x) * sqrt(pow(cos(x), -2.0))), 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 <= (-4.5d-9)) then
tmp = (t_0 * (1.0d0 / (1.0d0 - (tan(x) * tan(eps))))) - tan(x)
else if (eps <= 4.5d-9) then
tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ** (-2.0d0)))) ** 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 <= -4.5e-9) {
tmp = (t_0 * (1.0 / (1.0 - (Math.tan(x) * Math.tan(eps))))) - Math.tan(x);
} else if (eps <= 4.5e-9) {
tmp = eps + (eps * Math.pow((Math.sin(x) * Math.sqrt(Math.pow(Math.cos(x), -2.0))), 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 <= -4.5e-9: tmp = (t_0 * (1.0 / (1.0 - (math.tan(x) * math.tan(eps))))) - math.tan(x) elif eps <= 4.5e-9: tmp = eps + (eps * math.pow((math.sin(x) * math.sqrt(math.pow(math.cos(x), -2.0))), 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 <= -4.5e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps))))) - tan(x)); elseif (eps <= 4.5e-9) tmp = Float64(eps + Float64(eps * (Float64(sin(x) * sqrt((cos(x) ^ -2.0))) ^ 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 <= -4.5e-9) tmp = (t_0 * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x); elseif (eps <= 4.5e-9) tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ^ -2.0))) ^ 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, -4.5e-9], N[(N[(t$95$0 * N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.5e-9], N[(eps + N[(eps * N[Power[N[(N[Sin[x], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $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 -4.5 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.5 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\left(\sin x \cdot \sqrt{{\cos x}^{-2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x}{\frac{1}{\tan \varepsilon}}} - \tan x\\
\end{array}
\end{array}
if eps < -4.49999999999999976e-9Initial program 57.5%
tan-sum99.6%
div-inv99.7%
Applied egg-rr99.7%
if -4.49999999999999976e-9 < eps < 4.49999999999999976e-9Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
add-sqr-sqrt99.4%
pow299.4%
div-inv99.4%
sqrt-prod99.5%
unpow299.5%
sqrt-prod47.9%
add-sqr-sqrt99.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 4.49999999999999976e-9 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
tan-quot99.5%
clear-num99.4%
un-div-inv99.5%
clear-num99.5%
tan-quot99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x eps) :precision binary64 (if (or (<= eps -4.5e-9) (not (<= eps 2.6e-9))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (+ eps (* eps (pow (* (sin x) (sqrt (pow (cos x) -2.0))) 2.0)))))
double code(double x, double eps) {
double tmp;
if ((eps <= -4.5e-9) || !(eps <= 2.6e-9)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = eps + (eps * pow((sin(x) * sqrt(pow(cos(x), -2.0))), 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.5d-9)) .or. (.not. (eps <= 2.6d-9))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else
tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ** (-2.0d0)))) ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -4.5e-9) || !(eps <= 2.6e-9)) {
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) * Math.sqrt(Math.pow(Math.cos(x), -2.0))), 2.0));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -4.5e-9) or not (eps <= 2.6e-9): 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) * math.sqrt(math.pow(math.cos(x), -2.0))), 2.0)) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -4.5e-9) || !(eps <= 2.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(sin(x) * sqrt((cos(x) ^ -2.0))) ^ 2.0))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -4.5e-9) || ~((eps <= 2.6e-9))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x); else tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ^ -2.0))) ^ 2.0)); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -4.5e-9], N[Not[LessEqual[eps, 2.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[Power[N[(N[Sin[x], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -4.5 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 2.6 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\left(\sin x \cdot \sqrt{{\cos x}^{-2}}\right)}^{2}\\
\end{array}
\end{array}
if eps < -4.49999999999999976e-9 or 2.6000000000000001e-9 < eps Initial program 56.3%
tan-sum99.6%
div-inv99.5%
fma-neg99.6%
Applied egg-rr99.6%
fma-neg99.5%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
if -4.49999999999999976e-9 < eps < 2.6000000000000001e-9Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
add-sqr-sqrt99.4%
pow299.4%
div-inv99.4%
sqrt-prod99.5%
unpow299.5%
sqrt-prod47.9%
add-sqr-sqrt99.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))) (t_1 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -4e-9)
(- (* t_0 (/ 1.0 t_1)) (tan x))
(if (<= eps 2.7e-9)
(+ eps (* eps (pow (* (sin x) (sqrt (pow (cos x) -2.0))) 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 <= -4e-9) {
tmp = (t_0 * (1.0 / t_1)) - tan(x);
} else if (eps <= 2.7e-9) {
tmp = eps + (eps * pow((sin(x) * sqrt(pow(cos(x), -2.0))), 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 <= (-4d-9)) then
tmp = (t_0 * (1.0d0 / t_1)) - tan(x)
else if (eps <= 2.7d-9) then
tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ** (-2.0d0)))) ** 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 <= -4e-9) {
tmp = (t_0 * (1.0 / t_1)) - Math.tan(x);
} else if (eps <= 2.7e-9) {
tmp = eps + (eps * Math.pow((Math.sin(x) * Math.sqrt(Math.pow(Math.cos(x), -2.0))), 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 <= -4e-9: tmp = (t_0 * (1.0 / t_1)) - math.tan(x) elif eps <= 2.7e-9: tmp = eps + (eps * math.pow((math.sin(x) * math.sqrt(math.pow(math.cos(x), -2.0))), 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 <= -4e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / t_1)) - tan(x)); elseif (eps <= 2.7e-9) tmp = Float64(eps + Float64(eps * (Float64(sin(x) * sqrt((cos(x) ^ -2.0))) ^ 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 <= -4e-9) tmp = (t_0 * (1.0 / t_1)) - tan(x); elseif (eps <= 2.7e-9) tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ^ -2.0))) ^ 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, -4e-9], N[(N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 2.7e-9], N[(eps + N[(eps * N[Power[N[(N[Sin[x], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $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 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 2.7 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\left(\sin x \cdot \sqrt{{\cos x}^{-2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\end{array}
\end{array}
if eps < -4.00000000000000025e-9Initial program 57.5%
tan-sum99.6%
div-inv99.7%
Applied egg-rr99.7%
if -4.00000000000000025e-9 < eps < 2.7000000000000002e-9Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
add-sqr-sqrt99.4%
pow299.4%
div-inv99.4%
sqrt-prod99.5%
unpow299.5%
sqrt-prod47.9%
add-sqr-sqrt99.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 2.7000000000000002e-9 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (<= eps -1.2e-6)
(tan eps)
(if (<= eps 5.8e-7)
(+ eps (* eps (pow (* (sin x) (sqrt (pow (cos x) -2.0))) 2.0)))
(- (+ (tan x) (tan eps)) (tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -1.2e-6) {
tmp = tan(eps);
} else if (eps <= 5.8e-7) {
tmp = eps + (eps * pow((sin(x) * sqrt(pow(cos(x), -2.0))), 2.0));
} else {
tmp = (tan(x) + tan(eps)) - tan(x);
}
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 <= 5.8d-7) then
tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ** (-2.0d0)))) ** 2.0d0))
else
tmp = (tan(x) + tan(eps)) - tan(x)
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 <= 5.8e-7) {
tmp = eps + (eps * Math.pow((Math.sin(x) * Math.sqrt(Math.pow(Math.cos(x), -2.0))), 2.0));
} else {
tmp = (Math.tan(x) + Math.tan(eps)) - Math.tan(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -1.2e-6: tmp = math.tan(eps) elif eps <= 5.8e-7: tmp = eps + (eps * math.pow((math.sin(x) * math.sqrt(math.pow(math.cos(x), -2.0))), 2.0)) else: tmp = (math.tan(x) + math.tan(eps)) - math.tan(x) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -1.2e-6) tmp = tan(eps); elseif (eps <= 5.8e-7) tmp = Float64(eps + Float64(eps * (Float64(sin(x) * sqrt((cos(x) ^ -2.0))) ^ 2.0))); else tmp = Float64(Float64(tan(x) + tan(eps)) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -1.2e-6) tmp = tan(eps); elseif (eps <= 5.8e-7) tmp = eps + (eps * ((sin(x) * sqrt((cos(x) ^ -2.0))) ^ 2.0)); else tmp = (tan(x) + tan(eps)) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -1.2e-6], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 5.8e-7], N[(eps + N[(eps * N[Power[N[(N[Sin[x], $MachinePrecision] * N[Sqrt[N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.2 \cdot 10^{-6}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 5.8 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\left(\sin x \cdot \sqrt{{\cos x}^{-2}}\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) - \tan x\\
\end{array}
\end{array}
if eps < -1.1999999999999999e-6Initial program 57.5%
Taylor expanded in x around 0 60.3%
tan-quot60.6%
expm1-log1p-u48.3%
expm1-udef48.1%
Applied egg-rr48.1%
expm1-def48.3%
expm1-log1p60.6%
Simplified60.6%
if -1.1999999999999999e-6 < eps < 5.7999999999999995e-7Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
add-sqr-sqrt99.4%
pow299.4%
div-inv99.4%
sqrt-prod99.5%
unpow299.5%
sqrt-prod47.9%
add-sqr-sqrt99.5%
pow-flip99.5%
metadata-eval99.5%
Applied egg-rr99.5%
if 5.7999999999999995e-7 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in x around 0 57.9%
Final simplification79.3%
(FPCore (x eps)
:precision binary64
(if (<= eps -4e-5)
(tan eps)
(if (<= eps 5.2e-7)
(* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(- (+ (tan x) (tan eps)) (tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -4e-5) {
tmp = tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
} else {
tmp = (tan(x) + tan(eps)) - tan(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-4d-5)) then
tmp = tan(eps)
else if (eps <= 5.2d-7) then
tmp = eps * (((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)) + 1.0d0)
else
tmp = (tan(x) + tan(eps)) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -4e-5) {
tmp = Math.tan(eps);
} else if (eps <= 5.2e-7) {
tmp = eps * ((Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)) + 1.0);
} else {
tmp = (Math.tan(x) + Math.tan(eps)) - Math.tan(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -4e-5: tmp = math.tan(eps) elif eps <= 5.2e-7: tmp = eps * ((math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)) + 1.0) else: tmp = (math.tan(x) + math.tan(eps)) - math.tan(x) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -4e-5) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); else tmp = Float64(Float64(tan(x) + tan(eps)) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -4e-5) tmp = tan(eps); elseif (eps <= 5.2e-7) tmp = eps * (((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0); else tmp = (tan(x) + tan(eps)) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -4e-5], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 5.2e-7], N[(eps * N[(N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -4 \cdot 10^{-5}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) - \tan x\\
\end{array}
\end{array}
if eps < -4.00000000000000033e-5Initial program 57.5%
Taylor expanded in x around 0 60.3%
tan-quot60.6%
expm1-log1p-u48.3%
expm1-udef48.1%
Applied egg-rr48.1%
expm1-def48.3%
expm1-log1p60.6%
Simplified60.6%
if -4.00000000000000033e-5 < eps < 5.19999999999999998e-7Initial program 27.5%
tan-sum27.9%
div-inv27.9%
fma-neg27.9%
Applied egg-rr27.9%
Taylor expanded in eps around 0 99.4%
if 5.19999999999999998e-7 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in x around 0 57.9%
Final simplification79.3%
(FPCore (x eps)
:precision binary64
(if (<= eps -2.8e-5)
(tan eps)
(if (<= eps 6e-7)
(+ eps (* eps (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(- (+ (tan x) (tan eps)) (tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -2.8e-5) {
tmp = tan(eps);
} else if (eps <= 6e-7) {
tmp = eps + (eps * (pow(sin(x), 2.0) / pow(cos(x), 2.0)));
} else {
tmp = (tan(x) + tan(eps)) - tan(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-2.8d-5)) then
tmp = tan(eps)
else if (eps <= 6d-7) then
tmp = eps + (eps * ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))
else
tmp = (tan(x) + tan(eps)) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -2.8e-5) {
tmp = Math.tan(eps);
} else if (eps <= 6e-7) {
tmp = eps + (eps * (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = (Math.tan(x) + Math.tan(eps)) - Math.tan(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -2.8e-5: tmp = math.tan(eps) elif eps <= 6e-7: tmp = eps + (eps * (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0))) else: tmp = (math.tan(x) + math.tan(eps)) - math.tan(x) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -2.8e-5) tmp = tan(eps); elseif (eps <= 6e-7) tmp = Float64(eps + Float64(eps * Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))); else tmp = Float64(Float64(tan(x) + tan(eps)) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -2.8e-5) tmp = tan(eps); elseif (eps <= 6e-7) tmp = eps + (eps * ((sin(x) ^ 2.0) / (cos(x) ^ 2.0))); else tmp = (tan(x) + tan(eps)) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -2.8e-5], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 6e-7], 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[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.8 \cdot 10^{-5}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{{\sin x}^{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) - \tan x\\
\end{array}
\end{array}
if eps < -2.79999999999999996e-5Initial program 57.5%
Taylor expanded in x around 0 60.3%
tan-quot60.6%
expm1-log1p-u48.3%
expm1-udef48.1%
Applied egg-rr48.1%
expm1-def48.3%
expm1-log1p60.6%
Simplified60.6%
if -2.79999999999999996e-5 < eps < 5.9999999999999997e-7Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
if 5.9999999999999997e-7 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in x around 0 57.9%
Final simplification79.3%
(FPCore (x eps)
:precision binary64
(if (<= eps -3.6e-7)
(tan eps)
(if (<= eps 5.8e-7)
(+ eps (* eps (/ (- 0.5 (/ (cos (+ x x)) 2.0)) (pow (cos x) 2.0))))
(- (+ (tan x) (tan eps)) (tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -3.6e-7) {
tmp = tan(eps);
} else if (eps <= 5.8e-7) {
tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / pow(cos(x), 2.0)));
} else {
tmp = (tan(x) + tan(eps)) - tan(x);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if (eps <= (-3.6d-7)) then
tmp = tan(eps)
else if (eps <= 5.8d-7) then
tmp = eps + (eps * ((0.5d0 - (cos((x + x)) / 2.0d0)) / (cos(x) ** 2.0d0)))
else
tmp = (tan(x) + tan(eps)) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -3.6e-7) {
tmp = Math.tan(eps);
} else if (eps <= 5.8e-7) {
tmp = eps + (eps * ((0.5 - (Math.cos((x + x)) / 2.0)) / Math.pow(Math.cos(x), 2.0)));
} else {
tmp = (Math.tan(x) + Math.tan(eps)) - Math.tan(x);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -3.6e-7: tmp = math.tan(eps) elif eps <= 5.8e-7: tmp = eps + (eps * ((0.5 - (math.cos((x + x)) / 2.0)) / math.pow(math.cos(x), 2.0))) else: tmp = (math.tan(x) + math.tan(eps)) - math.tan(x) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -3.6e-7) tmp = tan(eps); elseif (eps <= 5.8e-7) 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) + tan(eps)) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -3.6e-7) tmp = tan(eps); elseif (eps <= 5.8e-7) tmp = eps + (eps * ((0.5 - (cos((x + x)) / 2.0)) / (cos(x) ^ 2.0))); else tmp = (tan(x) + tan(eps)) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -3.6e-7], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 5.8e-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[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.6 \cdot 10^{-7}:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 5.8 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot \frac{0.5 - \frac{\cos \left(x + x\right)}{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\tan x + \tan \varepsilon\right) - \tan x\\
\end{array}
\end{array}
if eps < -3.59999999999999994e-7Initial program 57.5%
Taylor expanded in x around 0 60.3%
tan-quot60.6%
expm1-log1p-u48.3%
expm1-udef48.1%
Applied egg-rr48.1%
expm1-def48.3%
expm1-log1p60.6%
Simplified60.6%
if -3.59999999999999994e-7 < eps < 5.7999999999999995e-7Initial program 27.5%
Taylor expanded in eps around 0 99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
unpow299.5%
sin-mult98.7%
Applied egg-rr98.7%
div-sub98.7%
+-inverses98.7%
cos-098.7%
metadata-eval98.7%
Simplified98.7%
if 5.7999999999999995e-7 < eps Initial program 54.6%
tan-sum99.5%
div-inv99.4%
fma-neg99.5%
Applied egg-rr99.5%
fma-neg99.4%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in x around 0 57.9%
Final simplification78.9%
(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 42.0%
Taylor expanded in x around 0 60.7%
tan-quot60.9%
expm1-log1p-u54.7%
expm1-udef26.5%
Applied egg-rr26.5%
expm1-def54.7%
expm1-log1p60.9%
Simplified60.9%
Final simplification60.9%
(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 42.0%
Taylor expanded in x around 0 60.7%
Taylor expanded in eps around 0 32.9%
Final simplification32.9%
(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 2023192
(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)))