
(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 (* (tan x) (tan eps))) (t_1 (+ (tan x) (tan eps))))
(if (<= eps -5.2e-5)
(/ (+ (* t_1 (cos x)) (* (sin x) (+ t_0 -1.0))) (* (cos x) (- 1.0 t_0)))
(if (<= eps 5.4e-5)
(+
(/
(sin eps)
(* (cos eps) (- 1.0 (/ (/ (* (sin x) (sin eps)) (cos eps)) (cos x)))))
(+
(* (pow (sin x) 2.0) (/ eps (pow (cos x) 2.0)))
(-
(/ (* eps eps) (/ (pow (cos x) 3.0) (pow (sin x) 3.0)))
(*
(pow eps 3.0)
(-
(* (sin x) (/ (* (/ (sin x) (cos x)) -0.3333333333333333) (cos x)))
(/ (pow (sin x) 4.0) (pow (cos x) 4.0)))))))
(- (/ t_1 (- (fma (tan x) (tan eps) -1.0))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) * tan(eps);
double t_1 = tan(x) + tan(eps);
double tmp;
if (eps <= -5.2e-5) {
tmp = ((t_1 * cos(x)) + (sin(x) * (t_0 + -1.0))) / (cos(x) * (1.0 - t_0));
} else if (eps <= 5.4e-5) {
tmp = (sin(eps) / (cos(eps) * (1.0 - (((sin(x) * sin(eps)) / cos(eps)) / cos(x))))) + ((pow(sin(x), 2.0) * (eps / pow(cos(x), 2.0))) + (((eps * eps) / (pow(cos(x), 3.0) / pow(sin(x), 3.0))) - (pow(eps, 3.0) * ((sin(x) * (((sin(x) / cos(x)) * -0.3333333333333333) / cos(x))) - (pow(sin(x), 4.0) / pow(cos(x), 4.0))))));
} else {
tmp = (t_1 / -fma(tan(x), tan(eps), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) * tan(eps)) t_1 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -5.2e-5) tmp = Float64(Float64(Float64(t_1 * cos(x)) + Float64(sin(x) * Float64(t_0 + -1.0))) / Float64(cos(x) * Float64(1.0 - t_0))); elseif (eps <= 5.4e-5) tmp = Float64(Float64(sin(eps) / Float64(cos(eps) * Float64(1.0 - Float64(Float64(Float64(sin(x) * sin(eps)) / cos(eps)) / cos(x))))) + Float64(Float64((sin(x) ^ 2.0) * Float64(eps / (cos(x) ^ 2.0))) + Float64(Float64(Float64(eps * eps) / Float64((cos(x) ^ 3.0) / (sin(x) ^ 3.0))) - Float64((eps ^ 3.0) * Float64(Float64(sin(x) * Float64(Float64(Float64(sin(x) / cos(x)) * -0.3333333333333333) / cos(x))) - Float64((sin(x) ^ 4.0) / (cos(x) ^ 4.0))))))); else tmp = Float64(Float64(t_1 / Float64(-fma(tan(x), tan(eps), -1.0))) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -5.2e-5], N[(N[(N[(t$95$1 * N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 5.4e-5], N[(N[(N[Sin[eps], $MachinePrecision] / N[(N[Cos[eps], $MachinePrecision] * N[(1.0 - N[(N[(N[(N[Sin[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] * N[(eps / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $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[Sin[x], $MachinePrecision] * N[(N[(N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] * -0.3333333333333333), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[N[Sin[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / (-N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision])), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x \cdot \tan \varepsilon\\
t_1 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -5.2 \cdot 10^{-5}:\\
\;\;\;\;\frac{t_1 \cdot \cos x + \sin x \cdot \left(t_0 + -1\right)}{\cos x \cdot \left(1 - t_0\right)}\\
\mathbf{elif}\;\varepsilon \leq 5.4 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sin \varepsilon}{\cos \varepsilon \cdot \left(1 - \frac{\frac{\sin x \cdot \sin \varepsilon}{\cos \varepsilon}}{\cos x}\right)} + \left({\sin x}^{2} \cdot \frac{\varepsilon}{{\cos x}^{2}} + \left(\frac{\varepsilon \cdot \varepsilon}{\frac{{\cos x}^{3}}{{\sin x}^{3}}} - {\varepsilon}^{3} \cdot \left(\sin x \cdot \frac{\frac{\sin x}{\cos x} \cdot -0.3333333333333333}{\cos x} - \frac{{\sin x}^{4}}{{\cos x}^{4}}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{-\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -5.19999999999999968e-5Initial program 51.6%
tan-sum99.4%
tan-quot99.2%
frac-sub99.4%
Applied egg-rr99.4%
if -5.19999999999999968e-5 < eps < 5.3999999999999998e-5Initial program 26.1%
tan-sum27.8%
div-inv27.8%
fma-neg27.8%
Applied egg-rr27.8%
Taylor expanded in x around inf 27.7%
associate--l+54.4%
associate-/r*54.4%
*-commutative54.4%
Simplified54.5%
Taylor expanded in eps around 0 99.7%
*-commutative99.7%
*-lft-identity99.7%
times-frac99.7%
/-rgt-identity99.7%
mul-1-neg99.7%
Simplified99.7%
if 5.3999999999999998e-5 < eps Initial program 47.2%
tan-sum99.4%
clear-num99.3%
Applied egg-rr99.3%
expm1-log1p-u85.7%
expm1-udef85.8%
log1p-udef85.8%
add-exp-log99.3%
Applied egg-rr99.3%
associate--l+99.3%
fma-neg99.3%
metadata-eval99.3%
Simplified99.3%
sub-neg99.3%
associate-/r/99.4%
associate--r+99.5%
metadata-eval99.5%
Applied egg-rr99.5%
sub-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
sub0-neg99.5%
Simplified99.5%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (tan x) (tan eps))) (t_1 (+ (tan x) (tan eps))))
(if (<= eps -9.2e-7)
(/ (+ (* t_1 (cos x)) (* (sin x) (+ t_0 -1.0))) (* (cos x) (- 1.0 t_0)))
(if (<= eps 4.2e-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)))))
(- (/ t_1 (- (fma (tan x) (tan eps) -1.0))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) * tan(eps);
double t_1 = tan(x) + tan(eps);
double tmp;
if (eps <= -9.2e-7) {
tmp = ((t_1 * cos(x)) + (sin(x) * (t_0 + -1.0))) / (cos(x) * (1.0 - t_0));
} else if (eps <= 4.2e-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 = (t_1 / -fma(tan(x), tan(eps), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) * tan(eps)) t_1 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -9.2e-7) tmp = Float64(Float64(Float64(t_1 * cos(x)) + Float64(sin(x) * Float64(t_0 + -1.0))) / Float64(cos(x) * Float64(1.0 - t_0))); elseif (eps <= 4.2e-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(t_1 / Float64(-fma(tan(x), tan(eps), -1.0))) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -9.2e-7], N[(N[(N[(t$95$1 * N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(t$95$0 + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * N[(1.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.2e-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[(t$95$1 / (-N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision])), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x \cdot \tan \varepsilon\\
t_1 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -9.2 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_1 \cdot \cos x + \sin x \cdot \left(t_0 + -1\right)}{\cos x \cdot \left(1 - t_0\right)}\\
\mathbf{elif}\;\varepsilon \leq 4.2 \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{t_1}{-\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -9.1999999999999998e-7Initial program 51.6%
tan-sum99.4%
tan-quot99.2%
frac-sub99.4%
Applied egg-rr99.4%
if -9.1999999999999998e-7 < eps < 4.2e-7Initial program 26.1%
tan-sum27.8%
clear-num27.5%
Applied egg-rr27.5%
Taylor expanded in eps around 0 99.4%
mul-1-neg99.4%
unsub-neg99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
distribute-lft-in99.5%
*-rgt-identity99.5%
Simplified99.5%
if 4.2e-7 < eps Initial program 47.2%
tan-sum99.4%
clear-num99.3%
Applied egg-rr99.3%
expm1-log1p-u85.7%
expm1-udef85.8%
log1p-udef85.8%
add-exp-log99.3%
Applied egg-rr99.3%
associate--l+99.3%
fma-neg99.3%
metadata-eval99.3%
Simplified99.3%
sub-neg99.3%
associate-/r/99.4%
associate--r+99.5%
metadata-eval99.5%
Applied egg-rr99.5%
sub-neg99.5%
associate-*l/99.5%
*-lft-identity99.5%
sub0-neg99.5%
Simplified99.5%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(if (or (<= eps -1.7e-9) (not (<= eps 3e-9)))
(fma
(+ (tan x) (tan eps))
(/ 1.0 (- 1.0 (* (tan x) (tan eps))))
(- (tan x)))
(fma eps (pow (tan x) 2.0) eps)))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.7e-9) || !(eps <= 3e-9)) {
tmp = fma((tan(x) + tan(eps)), (1.0 / (1.0 - (tan(x) * tan(eps)))), -tan(x));
} else {
tmp = fma(eps, pow(tan(x), 2.0), eps);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if ((eps <= -1.7e-9) || !(eps <= 3e-9)) tmp = fma(Float64(tan(x) + tan(eps)), Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), Float64(-tan(x))); else tmp = fma(eps, (tan(x) ^ 2.0), eps); end return tmp end
code[x_, eps_] := If[Or[LessEqual[eps, -1.7e-9], N[Not[LessEqual[eps, 3e-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[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.7 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 3 \cdot 10^{-9}\right):\\
\;\;\;\;\mathsf{fma}\left(\tan x + \tan \varepsilon, \frac{1}{1 - \tan x \cdot \tan \varepsilon}, -\tan x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\end{array}
\end{array}
if eps < -1.6999999999999999e-9 or 2.99999999999999998e-9 < eps Initial program 48.3%
tan-sum98.6%
div-inv98.6%
fma-neg98.7%
Applied egg-rr98.7%
if -1.6999999999999999e-9 < eps < 2.99999999999999998e-9Initial program 26.6%
tan-sum26.9%
div-inv26.9%
fma-neg26.9%
Applied egg-rr26.9%
Taylor expanded in eps around 0 99.3%
distribute-rgt-in99.4%
*-un-lft-identity99.4%
unpow299.4%
unpow299.4%
frac-times99.4%
tan-quot99.5%
tan-quot99.4%
pow299.4%
Applied egg-rr99.4%
+-commutative99.4%
*-commutative99.4%
fma-def99.4%
Simplified99.4%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -4.8e-9)
(- (* t_0 (/ 1.0 (- 1.0 (* (tan x) (tan eps))))) (tan x))
(if (<= eps 3.6e-9)
(fma eps (pow (tan x) 2.0) eps)
(- (/ t_0 (- (fma (tan x) (tan eps) -1.0))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -4.8e-9) {
tmp = (t_0 * (1.0 / (1.0 - (tan(x) * tan(eps))))) - tan(x);
} else if (eps <= 3.6e-9) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (t_0 / -fma(tan(x), tan(eps), -1.0)) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -4.8e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps))))) - tan(x)); elseif (eps <= 3.6e-9) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(t_0 / Float64(-fma(tan(x), tan(eps), -1.0))) - tan(x)); 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.8e-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, 3.6e-9], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], N[(N[(t$95$0 / (-N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + -1.0), $MachinePrecision])), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.8 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.6 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{-\mathsf{fma}\left(\tan x, \tan \varepsilon, -1\right)} - \tan x\\
\end{array}
\end{array}
if eps < -4.8e-9Initial program 50.8%
tan-sum53.9%
div-inv53.9%
Applied egg-rr99.0%
if -4.8e-9 < eps < 3.6e-9Initial program 26.5%
tan-sum27.1%
div-inv27.1%
fma-neg27.1%
Applied egg-rr27.1%
Taylor expanded in eps around 0 99.0%
distribute-rgt-in99.2%
*-un-lft-identity99.2%
unpow299.2%
unpow299.2%
frac-times99.1%
tan-quot99.3%
tan-quot99.2%
pow299.2%
Applied egg-rr99.2%
+-commutative99.2%
*-commutative99.2%
fma-def99.2%
Simplified99.2%
if 3.6e-9 < eps Initial program 46.5%
tan-sum98.9%
clear-num98.8%
Applied egg-rr98.8%
expm1-log1p-u85.4%
expm1-udef85.5%
log1p-udef85.5%
add-exp-log98.8%
Applied egg-rr98.8%
associate--l+98.8%
fma-neg98.8%
metadata-eval98.8%
Simplified98.8%
sub-neg98.8%
associate-/r/98.9%
associate--r+99.0%
metadata-eval99.0%
Applied egg-rr99.0%
sub-neg99.0%
associate-*l/98.9%
*-lft-identity98.9%
sub0-neg98.9%
Simplified98.9%
Final simplification99.1%
(FPCore (x eps) :precision binary64 (if (or (<= eps -2.6e-9) (not (<= eps 4.2e-9))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (fma eps (pow (tan x) 2.0) eps)))
double code(double x, double eps) {
double tmp;
if ((eps <= -2.6e-9) || !(eps <= 4.2e-9)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = fma(eps, pow(tan(x), 2.0), eps);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if ((eps <= -2.6e-9) || !(eps <= 4.2e-9)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); else tmp = fma(eps, (tan(x) ^ 2.0), eps); end return tmp end
code[x_, eps_] := If[Or[LessEqual[eps, -2.6e-9], N[Not[LessEqual[eps, 4.2e-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[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.6 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 4.2 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\end{array}
\end{array}
if eps < -2.6000000000000001e-9 or 4.20000000000000039e-9 < eps Initial program 48.7%
tan-sum98.9%
div-inv98.9%
fma-neg99.0%
Applied egg-rr99.0%
fma-neg98.9%
associate-*r/98.9%
*-rgt-identity98.9%
Simplified98.9%
if -2.6000000000000001e-9 < eps < 4.20000000000000039e-9Initial program 26.5%
tan-sum27.1%
div-inv27.1%
fma-neg27.1%
Applied egg-rr27.1%
Taylor expanded in eps around 0 99.0%
distribute-rgt-in99.2%
*-un-lft-identity99.2%
unpow299.2%
unpow299.2%
frac-times99.1%
tan-quot99.3%
tan-quot99.2%
pow299.2%
Applied egg-rr99.2%
+-commutative99.2%
*-commutative99.2%
fma-def99.2%
Simplified99.2%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))) (t_1 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -4.3e-9)
(- (* t_0 (/ 1.0 t_1)) (tan x))
(if (<= eps 3.7e-9)
(fma eps (pow (tan x) 2.0) eps)
(- (/ 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.3e-9) {
tmp = (t_0 * (1.0 / t_1)) - tan(x);
} else if (eps <= 3.7e-9) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (t_0 / t_1) - 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.3e-9) tmp = Float64(Float64(t_0 * Float64(1.0 / t_1)) - tan(x)); elseif (eps <= 3.7e-9) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(t_0 / t_1) - tan(x)); end return 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.3e-9], N[(N[(t$95$0 * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.7e-9], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $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.3 \cdot 10^{-9}:\\
\;\;\;\;t_0 \cdot \frac{1}{t_1} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.7 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\end{array}
\end{array}
if eps < -4.29999999999999963e-9Initial program 50.8%
tan-sum53.9%
div-inv53.9%
Applied egg-rr99.0%
if -4.29999999999999963e-9 < eps < 3.7e-9Initial program 26.5%
tan-sum27.1%
div-inv27.1%
fma-neg27.1%
Applied egg-rr27.1%
Taylor expanded in eps around 0 99.0%
distribute-rgt-in99.2%
*-un-lft-identity99.2%
unpow299.2%
unpow299.2%
frac-times99.1%
tan-quot99.3%
tan-quot99.2%
pow299.2%
Applied egg-rr99.2%
+-commutative99.2%
*-commutative99.2%
fma-def99.2%
Simplified99.2%
if 3.7e-9 < eps Initial program 46.5%
tan-sum98.9%
div-inv98.8%
fma-neg99.0%
Applied egg-rr99.0%
fma-neg98.8%
associate-*r/98.9%
*-rgt-identity98.9%
Simplified98.9%
Final simplification99.1%
(FPCore (x eps)
:precision binary64
(if (<= eps -0.00155)
(tan eps)
(if (<= eps 0.000112)
(fma eps (pow (tan x) 2.0) eps)
(/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.00155) {
tmp = tan(eps);
} else if (eps <= 0.000112) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -0.00155) tmp = tan(eps); elseif (eps <= 0.000112) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * tan(eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -0.00155], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 0.000112], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], 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]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.00155:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 0.000112:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon}\\
\end{array}
\end{array}
if eps < -0.00154999999999999995Initial program 52.4%
Taylor expanded in x around 0 55.5%
tan-quot55.8%
expm1-log1p-u40.7%
expm1-udef40.4%
Applied egg-rr40.4%
expm1-def40.7%
expm1-log1p55.8%
Simplified55.8%
if -0.00154999999999999995 < eps < 1.11999999999999998e-4Initial program 26.0%
tan-sum28.2%
div-inv28.2%
fma-neg28.3%
Applied egg-rr28.3%
Taylor expanded in eps around 0 97.9%
distribute-rgt-in98.0%
*-un-lft-identity98.0%
unpow298.0%
unpow298.0%
frac-times98.0%
tan-quot98.1%
tan-quot98.0%
pow298.0%
Applied egg-rr98.0%
+-commutative98.0%
*-commutative98.0%
fma-def98.0%
Simplified98.0%
if 1.11999999999999998e-4 < eps Initial program 47.2%
add-cbrt-cube47.0%
pow1/322.5%
pow322.3%
pow-to-exp22.4%
pow-exp22.3%
Applied egg-rr22.3%
associate-*l*22.3%
metadata-eval22.3%
pow-to-exp47.2%
pow147.2%
add-sqr-sqrt22.1%
sqrt-unprod27.2%
pow227.2%
Applied egg-rr27.2%
unpow227.2%
rem-sqrt-square27.2%
+-commutative27.2%
Simplified27.2%
Taylor expanded in x around 0 27.9%
+-commutative27.9%
unpow127.9%
sqr-pow21.7%
fabs-sqr21.7%
sqr-pow46.9%
unpow146.9%
Simplified46.9%
tan-sum52.3%
div-inv52.3%
Applied egg-rr52.3%
associate-*r/52.3%
*-rgt-identity52.3%
Simplified52.3%
Final simplification77.7%
(FPCore (x eps)
:precision binary64
(if (<= eps -0.00155)
(tan eps)
(if (<= eps 6.5e-5)
(fma eps (pow (tan x) 2.0) eps)
(- (/ 1.0 (/ (cos eps) (sin eps))) (tan x)))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.00155) {
tmp = tan(eps);
} else if (eps <= 6.5e-5) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (1.0 / (cos(eps) / sin(eps))) - tan(x);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -0.00155) tmp = tan(eps); elseif (eps <= 6.5e-5) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(1.0 / Float64(cos(eps) / sin(eps))) - tan(x)); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -0.00155], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 6.5e-5], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], N[(N[(1.0 / N[(N[Cos[eps], $MachinePrecision] / N[Sin[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.00155:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 6.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\cos \varepsilon}{\sin \varepsilon}} - \tan x\\
\end{array}
\end{array}
if eps < -0.00154999999999999995Initial program 52.4%
Taylor expanded in x around 0 55.5%
tan-quot55.8%
expm1-log1p-u40.7%
expm1-udef40.4%
Applied egg-rr40.4%
expm1-def40.7%
expm1-log1p55.8%
Simplified55.8%
if -0.00154999999999999995 < eps < 6.49999999999999943e-5Initial program 26.0%
tan-sum28.2%
div-inv28.2%
fma-neg28.3%
Applied egg-rr28.3%
Taylor expanded in eps around 0 97.9%
distribute-rgt-in98.0%
*-un-lft-identity98.0%
unpow298.0%
unpow298.0%
frac-times98.0%
tan-quot98.1%
tan-quot98.0%
pow298.0%
Applied egg-rr98.0%
+-commutative98.0%
*-commutative98.0%
fma-def98.0%
Simplified98.0%
if 6.49999999999999943e-5 < eps Initial program 47.2%
tan-sum99.4%
clear-num99.3%
Applied egg-rr99.3%
Taylor expanded in x around 0 50.6%
Final simplification77.4%
(FPCore (x eps) :precision binary64 (if (<= eps -0.00155) (tan eps) (if (<= eps 2.9e-6) (fma eps (pow (tan x) 2.0) eps) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.00155) {
tmp = tan(eps);
} else if (eps <= 2.9e-6) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = tan(eps);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -0.00155) tmp = tan(eps); elseif (eps <= 2.9e-6) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = tan(eps); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -0.00155], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 2.9e-6], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], N[Tan[eps], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.00155:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 2.9 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.00154999999999999995 or 2.9000000000000002e-6 < eps Initial program 49.8%
Taylor expanded in x around 0 52.6%
tan-quot52.9%
expm1-log1p-u39.6%
expm1-udef39.4%
Applied egg-rr39.4%
expm1-def39.6%
expm1-log1p52.9%
Simplified52.9%
if -0.00154999999999999995 < eps < 2.9000000000000002e-6Initial program 26.0%
tan-sum28.2%
div-inv28.2%
fma-neg28.3%
Applied egg-rr28.3%
Taylor expanded in eps around 0 97.9%
distribute-rgt-in98.0%
*-un-lft-identity98.0%
unpow298.0%
unpow298.0%
frac-times98.0%
tan-quot98.1%
tan-quot98.0%
pow298.0%
Applied egg-rr98.0%
+-commutative98.0%
*-commutative98.0%
fma-def98.0%
Simplified98.0%
Final simplification77.2%
(FPCore (x eps) :precision binary64 (if (<= eps -0.00155) (tan eps) (if (<= eps 1.05e-5) (* eps (+ 1.0 (pow (tan x) 2.0))) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.00155) {
tmp = tan(eps);
} else if (eps <= 1.05e-5) {
tmp = 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.00155d0)) then
tmp = tan(eps)
else if (eps <= 1.05d-5) then
tmp = 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.00155) {
tmp = Math.tan(eps);
} else if (eps <= 1.05e-5) {
tmp = 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.00155: tmp = math.tan(eps) elif eps <= 1.05e-5: tmp = 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.00155) tmp = tan(eps); elseif (eps <= 1.05e-5) tmp = 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.00155) tmp = tan(eps); elseif (eps <= 1.05e-5) tmp = eps * (1.0 + (tan(x) ^ 2.0)); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.00155], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 1.05e-5], N[(eps * N[(1.0 + 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.00155:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 1.05 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon \cdot \left(1 + {\tan x}^{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.00154999999999999995 or 1.04999999999999994e-5 < eps Initial program 49.8%
Taylor expanded in x around 0 52.6%
tan-quot52.9%
expm1-log1p-u39.6%
expm1-udef39.4%
Applied egg-rr39.4%
expm1-def39.6%
expm1-log1p52.9%
Simplified52.9%
if -0.00154999999999999995 < eps < 1.04999999999999994e-5Initial program 26.0%
tan-sum28.2%
div-inv28.2%
fma-neg28.3%
Applied egg-rr28.3%
Taylor expanded in eps around 0 97.9%
unpow297.9%
unpow297.9%
frac-times97.9%
tan-quot97.9%
tan-quot97.9%
*-un-lft-identity97.9%
pow297.9%
Applied egg-rr97.9%
*-lft-identity97.9%
Simplified97.9%
Final simplification77.1%
(FPCore (x eps) :precision binary64 (if (<= eps -0.00155) (tan eps) (if (<= eps 3.35e-6) (+ eps (* eps (pow (tan x) 2.0))) (tan eps))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.00155) {
tmp = tan(eps);
} else if (eps <= 3.35e-6) {
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.00155d0)) then
tmp = tan(eps)
else if (eps <= 3.35d-6) 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.00155) {
tmp = Math.tan(eps);
} else if (eps <= 3.35e-6) {
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.00155: tmp = math.tan(eps) elif eps <= 3.35e-6: 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.00155) tmp = tan(eps); elseif (eps <= 3.35e-6) 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.00155) tmp = tan(eps); elseif (eps <= 3.35e-6) tmp = eps + (eps * (tan(x) ^ 2.0)); else tmp = tan(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.00155], N[Tan[eps], $MachinePrecision], If[LessEqual[eps, 3.35e-6], 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.00155:\\
\;\;\;\;\tan \varepsilon\\
\mathbf{elif}\;\varepsilon \leq 3.35 \cdot 10^{-6}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\tan x}^{2}\\
\mathbf{else}:\\
\;\;\;\;\tan \varepsilon\\
\end{array}
\end{array}
if eps < -0.00154999999999999995 or 3.35e-6 < eps Initial program 49.8%
Taylor expanded in x around 0 52.6%
tan-quot52.9%
expm1-log1p-u39.6%
expm1-udef39.4%
Applied egg-rr39.4%
expm1-def39.6%
expm1-log1p52.9%
Simplified52.9%
if -0.00154999999999999995 < eps < 3.35e-6Initial program 26.0%
tan-sum28.2%
div-inv28.2%
fma-neg28.3%
Applied egg-rr28.3%
Taylor expanded in eps around 0 97.9%
distribute-rgt-in98.0%
*-un-lft-identity98.0%
unpow298.0%
unpow298.0%
frac-times98.0%
tan-quot98.1%
tan-quot98.0%
pow298.0%
Applied egg-rr98.0%
Final simplification77.2%
(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 37.0%
Taylor expanded in x around 0 52.7%
tan-quot52.8%
expm1-log1p-u46.7%
expm1-udef21.7%
Applied egg-rr21.7%
expm1-def46.7%
expm1-log1p52.8%
Simplified52.8%
Final simplification52.8%
(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 37.0%
Taylor expanded in x around 0 52.7%
Taylor expanded in eps around 0 29.9%
Final simplification29.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 2023274
(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)))