
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (tan (+ x eps)) (tan x)))
double code(double x, double eps) {
return tan((x + eps)) - tan(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = tan((x + eps)) - tan(x)
end function
public static double code(double x, double eps) {
return Math.tan((x + eps)) - Math.tan(x);
}
def code(x, eps): return math.tan((x + eps)) - math.tan(x)
function code(x, eps) return Float64(tan(Float64(x + eps)) - tan(x)) end
function tmp = code(x, eps) tmp = tan((x + eps)) - tan(x); end
code[x_, eps_] := N[(N[Tan[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\tan \left(x + \varepsilon\right) - \tan x
\end{array}
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (cos x) 3.0))
(t_1 (/ (sin eps) (cos eps)))
(t_2 (pow (sin x) 2.0))
(t_3 (pow (cos x) 2.0))
(t_4 (* -0.3333333333333333 (/ t_2 t_3)))
(t_5 (+ (tan x) (tan eps)))
(t_6 (/ (pow (sin x) 4.0) (pow (cos x) 4.0)))
(t_7 (pow (sin x) 3.0)))
(if (<= eps -0.00025)
(fma (/ 1.0 (- 1.0 (* (tan x) (tan eps)))) t_5 (- (tan x)))
(if (<= eps 0.000185)
(+
(/ t_1 (- 1.0 (* t_1 (/ (sin x) (cos x)))))
(+
(* (pow eps 3.0) (- t_6 t_4))
(-
(+ (/ (* eps t_2) t_3) (/ (* t_7 (pow eps 2.0)) t_0))
(*
(pow eps 4.0)
(+
(* -0.3333333333333333 (/ t_7 t_0))
(/ (* (sin x) (- t_4 t_6)) (cos x)))))))
(- (/ t_5 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = pow(cos(x), 3.0);
double t_1 = sin(eps) / cos(eps);
double t_2 = pow(sin(x), 2.0);
double t_3 = pow(cos(x), 2.0);
double t_4 = -0.3333333333333333 * (t_2 / t_3);
double t_5 = tan(x) + tan(eps);
double t_6 = pow(sin(x), 4.0) / pow(cos(x), 4.0);
double t_7 = pow(sin(x), 3.0);
double tmp;
if (eps <= -0.00025) {
tmp = fma((1.0 / (1.0 - (tan(x) * tan(eps)))), t_5, -tan(x));
} else if (eps <= 0.000185) {
tmp = (t_1 / (1.0 - (t_1 * (sin(x) / cos(x))))) + ((pow(eps, 3.0) * (t_6 - t_4)) + ((((eps * t_2) / t_3) + ((t_7 * pow(eps, 2.0)) / t_0)) - (pow(eps, 4.0) * ((-0.3333333333333333 * (t_7 / t_0)) + ((sin(x) * (t_4 - t_6)) / cos(x))))));
} else {
tmp = (t_5 / (1.0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = cos(x) ^ 3.0 t_1 = Float64(sin(eps) / cos(eps)) t_2 = sin(x) ^ 2.0 t_3 = cos(x) ^ 2.0 t_4 = Float64(-0.3333333333333333 * Float64(t_2 / t_3)) t_5 = Float64(tan(x) + tan(eps)) t_6 = Float64((sin(x) ^ 4.0) / (cos(x) ^ 4.0)) t_7 = sin(x) ^ 3.0 tmp = 0.0 if (eps <= -0.00025) tmp = fma(Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), t_5, Float64(-tan(x))); elseif (eps <= 0.000185) tmp = Float64(Float64(t_1 / Float64(1.0 - Float64(t_1 * Float64(sin(x) / cos(x))))) + Float64(Float64((eps ^ 3.0) * Float64(t_6 - t_4)) + Float64(Float64(Float64(Float64(eps * t_2) / t_3) + Float64(Float64(t_7 * (eps ^ 2.0)) / t_0)) - Float64((eps ^ 4.0) * Float64(Float64(-0.3333333333333333 * Float64(t_7 / t_0)) + Float64(Float64(sin(x) * Float64(t_4 - t_6)) / cos(x))))))); else tmp = Float64(Float64(t_5 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / cos(x)))) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[(-0.3333333333333333 * N[(t$95$2 / t$95$3), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[Power[N[Sin[x], $MachinePrecision], 4.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 4.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision]}, If[LessEqual[eps, -0.00025], N[(N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$5 + (-N[Tan[x], $MachinePrecision])), $MachinePrecision], If[LessEqual[eps, 0.000185], N[(N[(t$95$1 / N[(1.0 - N[(t$95$1 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[eps, 3.0], $MachinePrecision] * N[(t$95$6 - t$95$4), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(eps * t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision] + N[(N[(t$95$7 * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[Power[eps, 4.0], $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(t$95$7 / t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Sin[x], $MachinePrecision] * N[(t$95$4 - t$95$6), $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$5 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\cos x}^{3}\\
t_1 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
t_2 := {\sin x}^{2}\\
t_3 := {\cos x}^{2}\\
t_4 := -0.3333333333333333 \cdot \frac{t_2}{t_3}\\
t_5 := \tan x + \tan \varepsilon\\
t_6 := \frac{{\sin x}^{4}}{{\cos x}^{4}}\\
t_7 := {\sin x}^{3}\\
\mathbf{if}\;\varepsilon \leq -0.00025:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{1 - \tan x \cdot \tan \varepsilon}, t_5, -\tan x\right)\\
\mathbf{elif}\;\varepsilon \leq 0.000185:\\
\;\;\;\;\frac{t_1}{1 - t_1 \cdot \frac{\sin x}{\cos x}} + \left({\varepsilon}^{3} \cdot \left(t_6 - t_4\right) + \left(\left(\frac{\varepsilon \cdot t_2}{t_3} + \frac{t_7 \cdot {\varepsilon}^{2}}{t_0}\right) - {\varepsilon}^{4} \cdot \left(-0.3333333333333333 \cdot \frac{t_7}{t_0} + \frac{\sin x \cdot \left(t_4 - t_6\right)}{\cos x}\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_5}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -2.5000000000000001e-4Initial program 47.6%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
clear-num99.2%
associate-/r/99.3%
fma-neg99.4%
Applied egg-rr99.4%
if -2.5000000000000001e-4 < eps < 1.85e-4Initial program 33.7%
tan-sum35.7%
div-inv35.6%
Applied egg-rr35.6%
associate-*r/35.7%
*-rgt-identity35.7%
Simplified35.7%
Taylor expanded in x around inf 35.6%
associate--l+63.4%
associate-/r*63.4%
times-frac63.4%
Simplified63.5%
tan-quot62.1%
sub-neg62.1%
tan-quot63.5%
tan-quot63.5%
tan-quot63.5%
Applied egg-rr63.5%
sub-neg63.5%
*-commutative63.5%
Simplified63.5%
Taylor expanded in eps around 0 99.6%
if 1.85e-4 < eps Initial program 52.9%
tan-sum99.7%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
*-commutative99.7%
tan-quot99.6%
associate-*r/99.7%
Applied egg-rr99.7%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (pow (sin x) 2.0))
(t_1 (pow (cos x) 2.0))
(t_2 (/ (sin eps) (cos eps)))
(t_3 (+ (tan x) (tan eps))))
(if (<= eps -4.6e-5)
(- (/ t_3 (- 1.0 (* (tan x) (tan eps)))) (tan x))
(if (<= eps 6.5e-5)
(+
(/ t_2 (- 1.0 (* t_2 (/ (sin x) (cos x)))))
(-
(+
(/ (* eps t_0) t_1)
(/ (* (pow (sin x) 3.0) (pow eps 2.0)) (pow (cos x) 3.0)))
(*
(pow eps 3.0)
(-
(* -0.3333333333333333 (/ t_0 t_1))
(/ (pow (sin x) 4.0) (pow (cos x) 4.0))))))
(- (/ t_3 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = pow(sin(x), 2.0);
double t_1 = pow(cos(x), 2.0);
double t_2 = sin(eps) / cos(eps);
double t_3 = tan(x) + tan(eps);
double tmp;
if (eps <= -4.6e-5) {
tmp = (t_3 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else if (eps <= 6.5e-5) {
tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + ((((eps * t_0) / t_1) + ((pow(sin(x), 3.0) * pow(eps, 2.0)) / pow(cos(x), 3.0))) - (pow(eps, 3.0) * ((-0.3333333333333333 * (t_0 / t_1)) - (pow(sin(x), 4.0) / pow(cos(x), 4.0)))));
} else {
tmp = (t_3 / (1.0 - ((tan(eps) * sin(x)) / 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sin(x) ** 2.0d0
t_1 = cos(x) ** 2.0d0
t_2 = sin(eps) / cos(eps)
t_3 = tan(x) + tan(eps)
if (eps <= (-4.6d-5)) then
tmp = (t_3 / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else if (eps <= 6.5d-5) then
tmp = (t_2 / (1.0d0 - (t_2 * (sin(x) / cos(x))))) + ((((eps * t_0) / t_1) + (((sin(x) ** 3.0d0) * (eps ** 2.0d0)) / (cos(x) ** 3.0d0))) - ((eps ** 3.0d0) * (((-0.3333333333333333d0) * (t_0 / t_1)) - ((sin(x) ** 4.0d0) / (cos(x) ** 4.0d0)))))
else
tmp = (t_3 / (1.0d0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.pow(Math.sin(x), 2.0);
double t_1 = Math.pow(Math.cos(x), 2.0);
double t_2 = Math.sin(eps) / Math.cos(eps);
double t_3 = Math.tan(x) + Math.tan(eps);
double tmp;
if (eps <= -4.6e-5) {
tmp = (t_3 / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else if (eps <= 6.5e-5) {
tmp = (t_2 / (1.0 - (t_2 * (Math.sin(x) / Math.cos(x))))) + ((((eps * t_0) / t_1) + ((Math.pow(Math.sin(x), 3.0) * Math.pow(eps, 2.0)) / Math.pow(Math.cos(x), 3.0))) - (Math.pow(eps, 3.0) * ((-0.3333333333333333 * (t_0 / t_1)) - (Math.pow(Math.sin(x), 4.0) / Math.pow(Math.cos(x), 4.0)))));
} else {
tmp = (t_3 / (1.0 - ((Math.tan(eps) * Math.sin(x)) / Math.cos(x)))) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.pow(math.sin(x), 2.0) t_1 = math.pow(math.cos(x), 2.0) t_2 = math.sin(eps) / math.cos(eps) t_3 = math.tan(x) + math.tan(eps) tmp = 0 if eps <= -4.6e-5: tmp = (t_3 / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) elif eps <= 6.5e-5: tmp = (t_2 / (1.0 - (t_2 * (math.sin(x) / math.cos(x))))) + ((((eps * t_0) / t_1) + ((math.pow(math.sin(x), 3.0) * math.pow(eps, 2.0)) / math.pow(math.cos(x), 3.0))) - (math.pow(eps, 3.0) * ((-0.3333333333333333 * (t_0 / t_1)) - (math.pow(math.sin(x), 4.0) / math.pow(math.cos(x), 4.0))))) else: tmp = (t_3 / (1.0 - ((math.tan(eps) * math.sin(x)) / math.cos(x)))) - math.tan(x) return tmp
function code(x, eps) t_0 = sin(x) ^ 2.0 t_1 = cos(x) ^ 2.0 t_2 = Float64(sin(eps) / cos(eps)) t_3 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -4.6e-5) tmp = Float64(Float64(t_3 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); elseif (eps <= 6.5e-5) tmp = Float64(Float64(t_2 / Float64(1.0 - Float64(t_2 * Float64(sin(x) / cos(x))))) + Float64(Float64(Float64(Float64(eps * t_0) / t_1) + Float64(Float64((sin(x) ^ 3.0) * (eps ^ 2.0)) / (cos(x) ^ 3.0))) - Float64((eps ^ 3.0) * Float64(Float64(-0.3333333333333333 * Float64(t_0 / t_1)) - Float64((sin(x) ^ 4.0) / (cos(x) ^ 4.0)))))); else tmp = Float64(Float64(t_3 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / cos(x)))) - tan(x)); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin(x) ^ 2.0; t_1 = cos(x) ^ 2.0; t_2 = sin(eps) / cos(eps); t_3 = tan(x) + tan(eps); tmp = 0.0; if (eps <= -4.6e-5) tmp = (t_3 / (1.0 - (tan(x) * tan(eps)))) - tan(x); elseif (eps <= 6.5e-5) tmp = (t_2 / (1.0 - (t_2 * (sin(x) / cos(x))))) + ((((eps * t_0) / t_1) + (((sin(x) ^ 3.0) * (eps ^ 2.0)) / (cos(x) ^ 3.0))) - ((eps ^ 3.0) * ((-0.3333333333333333 * (t_0 / t_1)) - ((sin(x) ^ 4.0) / (cos(x) ^ 4.0))))); else tmp = (t_3 / (1.0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.6e-5], N[(N[(t$95$3 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6.5e-5], N[(N[(t$95$2 / N[(1.0 - N[(t$95$2 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(eps * t$95$0), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(N[Power[N[Sin[x], $MachinePrecision], 3.0], $MachinePrecision] * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(t$95$0 / t$95$1), $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], N[(N[(t$95$3 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\sin x}^{2}\\
t_1 := {\cos x}^{2}\\
t_2 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
t_3 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.6 \cdot 10^{-5}:\\
\;\;\;\;\frac{t_3}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 6.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{t_2}{1 - t_2 \cdot \frac{\sin x}{\cos x}} + \left(\left(\frac{\varepsilon \cdot t_0}{t_1} + \frac{{\sin x}^{3} \cdot {\varepsilon}^{2}}{{\cos x}^{3}}\right) - {\varepsilon}^{3} \cdot \left(-0.3333333333333333 \cdot \frac{t_0}{t_1} - \frac{{\sin x}^{4}}{{\cos x}^{4}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_3}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -4.6e-5Initial program 47.0%
tan-sum99.2%
div-inv99.0%
Applied egg-rr99.0%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
if -4.6e-5 < eps < 6.49999999999999943e-5Initial program 34.0%
tan-sum35.2%
div-inv35.2%
Applied egg-rr35.2%
associate-*r/35.2%
*-rgt-identity35.2%
Simplified35.2%
Taylor expanded in x around inf 35.2%
associate--l+63.2%
associate-/r*63.2%
times-frac63.2%
Simplified63.3%
tan-quot62.0%
sub-neg62.0%
tan-quot63.3%
tan-quot63.3%
tan-quot63.3%
Applied egg-rr63.3%
sub-neg63.3%
*-commutative63.3%
Simplified63.3%
Taylor expanded in eps around 0 99.5%
if 6.49999999999999943e-5 < eps Initial program 52.9%
tan-sum99.7%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
*-commutative99.7%
tan-quot99.6%
associate-*r/99.7%
Applied egg-rr99.7%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(t_1 (+ (tan x) (tan eps))))
(if (<= eps -1.55e-7)
(- (/ t_1 (- 1.0 (* (tan x) (tan eps)))) (tan x))
(if (<= eps 3.1e-7)
(fma eps t_0 (* (/ (pow eps 2.0) (cos x)) (* (sin x) t_0)))
(- (/ t_1 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = (pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0;
double t_1 = tan(x) + tan(eps);
double tmp;
if (eps <= -1.55e-7) {
tmp = (t_1 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else if (eps <= 3.1e-7) {
tmp = fma(eps, t_0, ((pow(eps, 2.0) / cos(x)) * (sin(x) * t_0)));
} else {
tmp = (t_1 / (1.0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0) t_1 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -1.55e-7) tmp = Float64(Float64(t_1 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); elseif (eps <= 3.1e-7) tmp = fma(eps, t_0, Float64(Float64((eps ^ 2.0) / cos(x)) * Float64(sin(x) * t_0))); else tmp = Float64(Float64(t_1 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / cos(x)))) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -1.55e-7], N[(N[(t$95$1 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.1e-7], N[(eps * t$95$0 + N[(N[(N[Power[eps, 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\\
t_1 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -1.55 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_1}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.1 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, t_0, \frac{{\varepsilon}^{2}}{\cos x} \cdot \left(\sin x \cdot t_0\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -1.55e-7Initial program 47.0%
tan-sum99.2%
div-inv99.0%
Applied egg-rr99.0%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
if -1.55e-7 < eps < 3.1e-7Initial program 34.2%
Taylor expanded in eps around 0 99.4%
fma-def99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
associate-/l*99.4%
associate-/r/99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
if 3.1e-7 < eps Initial program 52.2%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
*-commutative99.4%
tan-quot99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -3.3e-7)
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))
(if (<= eps 6.2e-7)
(+
(* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(*
(pow eps 2.0)
(+ (/ (sin x) (cos x)) (/ (pow (sin x) 3.0) (pow (cos x) 3.0)))))
(- (/ t_0 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -3.3e-7) {
tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else if (eps <= 6.2e-7) {
tmp = (eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0)) + (pow(eps, 2.0) * ((sin(x) / cos(x)) + (pow(sin(x), 3.0) / pow(cos(x), 3.0))));
} else {
tmp = (t_0 / (1.0 - ((tan(eps) * sin(x)) / 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.3d-7)) then
tmp = (t_0 / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else if (eps <= 6.2d-7) then
tmp = (eps * (((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)) + 1.0d0)) + ((eps ** 2.0d0) * ((sin(x) / cos(x)) + ((sin(x) ** 3.0d0) / (cos(x) ** 3.0d0))))
else
tmp = (t_0 / (1.0d0 - ((tan(eps) * sin(x)) / 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.3e-7) {
tmp = (t_0 / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else if (eps <= 6.2e-7) {
tmp = (eps * ((Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)) + 1.0)) + (Math.pow(eps, 2.0) * ((Math.sin(x) / Math.cos(x)) + (Math.pow(Math.sin(x), 3.0) / Math.pow(Math.cos(x), 3.0))));
} else {
tmp = (t_0 / (1.0 - ((Math.tan(eps) * Math.sin(x)) / 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.3e-7: tmp = (t_0 / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) elif eps <= 6.2e-7: tmp = (eps * ((math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)) + 1.0)) + (math.pow(eps, 2.0) * ((math.sin(x) / math.cos(x)) + (math.pow(math.sin(x), 3.0) / math.pow(math.cos(x), 3.0)))) else: tmp = (t_0 / (1.0 - ((math.tan(eps) * math.sin(x)) / 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.3e-7) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); elseif (eps <= 6.2e-7) tmp = Float64(Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)) + Float64((eps ^ 2.0) * Float64(Float64(sin(x) / cos(x)) + Float64((sin(x) ^ 3.0) / (cos(x) ^ 3.0))))); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / 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.3e-7) tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x); elseif (eps <= 6.2e-7) tmp = (eps * (((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)) + ((eps ^ 2.0) * ((sin(x) / cos(x)) + ((sin(x) ^ 3.0) / (cos(x) ^ 3.0)))); else tmp = (t_0 / (1.0 - ((tan(eps) * sin(x)) / 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.3e-7], 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, 6.2e-7], N[(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[Power[eps, 2.0], $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$0 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $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.3 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 6.2 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right) + {\varepsilon}^{2} \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -3.3000000000000002e-7Initial program 47.0%
tan-sum99.2%
div-inv99.0%
Applied egg-rr99.0%
associate-*r/99.2%
*-rgt-identity99.2%
Simplified99.2%
if -3.3000000000000002e-7 < eps < 6.1999999999999999e-7Initial program 34.2%
tan-sum34.8%
div-inv34.8%
Applied egg-rr34.8%
associate-*r/34.8%
*-rgt-identity34.8%
Simplified34.8%
Taylor expanded in eps around 0 99.4%
+-commutative99.4%
mul-1-neg99.4%
unsub-neg99.4%
cancel-sign-sub-inv99.4%
metadata-eval99.4%
*-lft-identity99.4%
Simplified99.4%
if 6.1999999999999999e-7 < eps Initial program 52.2%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
*-commutative99.4%
tan-quot99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (/ (sin eps) (cos eps))) (t_1 (+ (tan x) (tan eps))))
(if (<= eps -4.8e-9)
(fma (/ 1.0 (- 1.0 (* (tan x) (tan eps)))) t_1 (- (tan x)))
(if (<= eps 7.3e-9)
(+
(/ t_0 (- 1.0 (* t_0 (/ (sin x) (cos x)))))
(/ (* eps (pow (sin x) 2.0)) (pow (cos x) 2.0)))
(- (/ t_1 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = sin(eps) / cos(eps);
double t_1 = tan(x) + tan(eps);
double tmp;
if (eps <= -4.8e-9) {
tmp = fma((1.0 / (1.0 - (tan(x) * tan(eps)))), t_1, -tan(x));
} else if (eps <= 7.3e-9) {
tmp = (t_0 / (1.0 - (t_0 * (sin(x) / cos(x))))) + ((eps * pow(sin(x), 2.0)) / pow(cos(x), 2.0));
} else {
tmp = (t_1 / (1.0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(sin(eps) / cos(eps)) t_1 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -4.8e-9) tmp = fma(Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), t_1, Float64(-tan(x))); elseif (eps <= 7.3e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(t_0 * Float64(sin(x) / cos(x))))) + Float64(Float64(eps * (sin(x) ^ 2.0)) / (cos(x) ^ 2.0))); else tmp = Float64(Float64(t_1 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / cos(x)))) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -4.8e-9], N[(N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1 + (-N[Tan[x], $MachinePrecision])), $MachinePrecision], If[LessEqual[eps, 7.3e-9], N[(N[(t$95$0 / N[(1.0 - N[(t$95$0 * N[(N[Sin[x], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(eps * N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$1 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{\sin \varepsilon}{\cos \varepsilon}\\
t_1 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.8 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{1 - \tan x \cdot \tan \varepsilon}, t_1, -\tan x\right)\\
\mathbf{elif}\;\varepsilon \leq 7.3 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - t_0 \cdot \frac{\sin x}{\cos x}} + \frac{\varepsilon \cdot {\sin x}^{2}}{{\cos x}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -4.8e-9Initial program 47.1%
tan-sum98.8%
div-inv98.7%
Applied egg-rr98.7%
associate-*r/98.8%
*-rgt-identity98.8%
Simplified98.8%
clear-num98.5%
associate-/r/98.7%
fma-neg98.8%
Applied egg-rr98.8%
if -4.8e-9 < eps < 7.30000000000000002e-9Initial program 34.1%
tan-sum34.5%
div-inv34.4%
Applied egg-rr34.4%
associate-*r/34.5%
*-rgt-identity34.5%
Simplified34.5%
Taylor expanded in x around inf 34.5%
associate--l+63.0%
associate-/r*63.0%
times-frac63.0%
Simplified63.0%
Taylor expanded in eps around 0 99.5%
if 7.30000000000000002e-9 < eps Initial program 52.2%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
*-commutative99.4%
tan-quot99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -3.65e-9)
(fma (/ 1.0 (- 1.0 (* (tan x) (tan eps)))) t_0 (- (tan x)))
(if (<= eps 3.2e-9)
(* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(- (/ t_0 (- 1.0 (/ (* (tan eps) (sin x)) (cos x)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -3.65e-9) {
tmp = fma((1.0 / (1.0 - (tan(x) * tan(eps)))), t_0, -tan(x));
} else if (eps <= 3.2e-9) {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
} else {
tmp = (t_0 / (1.0 - ((tan(eps) * sin(x)) / cos(x)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -3.65e-9) tmp = fma(Float64(1.0 / Float64(1.0 - Float64(tan(x) * tan(eps)))), t_0, Float64(-tan(x))); elseif (eps <= 3.2e-9) tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(eps) * sin(x)) / cos(x)))) - 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, -3.65e-9], N[(N[(1.0 / N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0 + (-N[Tan[x], $MachinePrecision])), $MachinePrecision], If[LessEqual[eps, 3.2e-9], 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[(t$95$0 / N[(1.0 - N[(N[(N[Tan[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[Cos[x], $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.65 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{1 - \tan x \cdot \tan \varepsilon}, t_0, -\tan x\right)\\
\mathbf{elif}\;\varepsilon \leq 3.2 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan \varepsilon \cdot \sin x}{\cos x}} - \tan x\\
\end{array}
\end{array}
if eps < -3.65000000000000001e-9Initial program 47.1%
tan-sum98.8%
div-inv98.7%
Applied egg-rr98.7%
associate-*r/98.8%
*-rgt-identity98.8%
Simplified98.8%
clear-num98.5%
associate-/r/98.7%
fma-neg98.8%
Applied egg-rr98.8%
if -3.65000000000000001e-9 < eps < 3.20000000000000012e-9Initial program 34.1%
Taylor expanded in eps around 0 99.5%
cancel-sign-sub-inv99.5%
metadata-eval99.5%
*-lft-identity99.5%
Simplified99.5%
if 3.20000000000000012e-9 < eps Initial program 52.2%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
*-commutative99.4%
tan-quot99.4%
associate-*r/99.5%
Applied egg-rr99.5%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (- 1.0 (* (tan x) (tan eps)))) (t_1 (+ (tan x) (tan eps))))
(if (<= eps -3.2e-9)
(fma (/ 1.0 t_0) t_1 (- (tan x)))
(if (<= eps 4.8e-9)
(* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(- (/ t_1 t_0) (tan x))))))
double code(double x, double eps) {
double t_0 = 1.0 - (tan(x) * tan(eps));
double t_1 = tan(x) + tan(eps);
double tmp;
if (eps <= -3.2e-9) {
tmp = fma((1.0 / t_0), t_1, -tan(x));
} else if (eps <= 4.8e-9) {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
} else {
tmp = (t_1 / t_0) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(1.0 - Float64(tan(x) * tan(eps))) t_1 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -3.2e-9) tmp = fma(Float64(1.0 / t_0), t_1, Float64(-tan(x))); elseif (eps <= 4.8e-9) tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); else tmp = Float64(Float64(t_1 / t_0) - tan(x)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -3.2e-9], N[(N[(1.0 / t$95$0), $MachinePrecision] * t$95$1 + (-N[Tan[x], $MachinePrecision])), $MachinePrecision], If[LessEqual[eps, 4.8e-9], 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[(t$95$1 / t$95$0), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 - \tan x \cdot \tan \varepsilon\\
t_1 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -3.2 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\frac{1}{t_0}, t_1, -\tan x\right)\\
\mathbf{elif}\;\varepsilon \leq 4.8 \cdot 10^{-9}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1}{t_0} - \tan x\\
\end{array}
\end{array}
if eps < -3.20000000000000012e-9Initial program 47.1%
tan-sum98.8%
div-inv98.7%
Applied egg-rr98.7%
associate-*r/98.8%
*-rgt-identity98.8%
Simplified98.8%
clear-num98.5%
associate-/r/98.7%
fma-neg98.8%
Applied egg-rr98.8%
if -3.20000000000000012e-9 < eps < 4.8e-9Initial program 34.1%
Taylor expanded in eps around 0 99.5%
cancel-sign-sub-inv99.5%
metadata-eval99.5%
*-lft-identity99.5%
Simplified99.5%
if 4.8e-9 < eps Initial program 52.2%
tan-sum99.4%
div-inv99.3%
Applied egg-rr99.3%
associate-*r/99.4%
*-rgt-identity99.4%
Simplified99.4%
Final simplification99.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -1.62e-9) (not (<= eps 3.1e-9))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* (tan x) (tan eps)))) (tan x)) (* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.62e-9) || !(eps <= 3.1e-9)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x);
} else {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-1.62d-9)) .or. (.not. (eps <= 3.1d-9))) then
tmp = ((tan(x) + tan(eps)) / (1.0d0 - (tan(x) * tan(eps)))) - tan(x)
else
tmp = eps * (((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -1.62e-9) || !(eps <= 3.1e-9)) {
tmp = ((Math.tan(x) + Math.tan(eps)) / (1.0 - (Math.tan(x) * Math.tan(eps)))) - Math.tan(x);
} else {
tmp = eps * ((Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)) + 1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -1.62e-9) or not (eps <= 3.1e-9): tmp = ((math.tan(x) + math.tan(eps)) / (1.0 - (math.tan(x) * math.tan(eps)))) - math.tan(x) else: tmp = eps * ((math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)) + 1.0) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -1.62e-9) || !(eps <= 3.1e-9)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(tan(x) * tan(eps)))) - tan(x)); else tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -1.62e-9) || ~((eps <= 3.1e-9))) tmp = ((tan(x) + tan(eps)) / (1.0 - (tan(x) * tan(eps)))) - tan(x); else tmp = eps * (((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -1.62e-9], N[Not[LessEqual[eps, 3.1e-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[(N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.62 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 3.1 \cdot 10^{-9}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\end{array}
\end{array}
if eps < -1.61999999999999999e-9 or 3.10000000000000005e-9 < eps Initial program 49.7%
tan-sum99.1%
div-inv99.0%
Applied egg-rr99.0%
associate-*r/99.1%
*-rgt-identity99.1%
Simplified99.1%
if -1.61999999999999999e-9 < eps < 3.10000000000000005e-9Initial program 34.1%
Taylor expanded in eps around 0 99.5%
cancel-sign-sub-inv99.5%
metadata-eval99.5%
*-lft-identity99.5%
Simplified99.5%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(if (<= eps -0.0016)
(-
(/ 1.0 (* (/ 1.0 (sin (+ eps x))) (- (cos eps) (* x (sin eps)))))
(tan x))
(if (<= eps 5e-5)
(* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))
(/ (sin eps) (cos eps)))))
double code(double x, double eps) {
double tmp;
if (eps <= -0.0016) {
tmp = (1.0 / ((1.0 / sin((eps + x))) * (cos(eps) - (x * sin(eps))))) - tan(x);
} else if (eps <= 5e-5) {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
} else {
tmp = sin(eps) / cos(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.0016d0)) then
tmp = (1.0d0 / ((1.0d0 / sin((eps + x))) * (cos(eps) - (x * sin(eps))))) - tan(x)
else if (eps <= 5d-5) then
tmp = eps * (((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)) + 1.0d0)
else
tmp = sin(eps) / cos(eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if (eps <= -0.0016) {
tmp = (1.0 / ((1.0 / Math.sin((eps + x))) * (Math.cos(eps) - (x * Math.sin(eps))))) - Math.tan(x);
} else if (eps <= 5e-5) {
tmp = eps * ((Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)) + 1.0);
} else {
tmp = Math.sin(eps) / Math.cos(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if eps <= -0.0016: tmp = (1.0 / ((1.0 / math.sin((eps + x))) * (math.cos(eps) - (x * math.sin(eps))))) - math.tan(x) elif eps <= 5e-5: tmp = eps * ((math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)) + 1.0) else: tmp = math.sin(eps) / math.cos(eps) return tmp
function code(x, eps) tmp = 0.0 if (eps <= -0.0016) tmp = Float64(Float64(1.0 / Float64(Float64(1.0 / sin(Float64(eps + x))) * Float64(cos(eps) - Float64(x * sin(eps))))) - tan(x)); elseif (eps <= 5e-5) tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); else tmp = Float64(sin(eps) / cos(eps)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if (eps <= -0.0016) tmp = (1.0 / ((1.0 / sin((eps + x))) * (cos(eps) - (x * sin(eps))))) - tan(x); elseif (eps <= 5e-5) tmp = eps * (((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0); else tmp = sin(eps) / cos(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[LessEqual[eps, -0.0016], N[(N[(1.0 / N[(N[(1.0 / N[Sin[N[(eps + x), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[eps], $MachinePrecision] - N[(x * N[Sin[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 5e-5], 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[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.0016:\\
\;\;\;\;\frac{1}{\frac{1}{\sin \left(\varepsilon + x\right)} \cdot \left(\cos \varepsilon - x \cdot \sin \varepsilon\right)} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 5 \cdot 10^{-5}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \varepsilon}{\cos \varepsilon}\\
\end{array}
\end{array}
if eps < -0.00160000000000000008Initial program 47.6%
tan-sum99.4%
clear-num99.2%
Applied egg-rr99.2%
clear-num99.2%
tan-sum47.6%
tan-quot47.5%
associate-/r/47.5%
Applied egg-rr47.5%
Taylor expanded in x around 0 49.5%
associate-*r*49.5%
mul-1-neg49.5%
Simplified49.5%
if -0.00160000000000000008 < eps < 5.00000000000000024e-5Initial program 33.7%
Taylor expanded in eps around 0 98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
Simplified98.0%
if 5.00000000000000024e-5 < eps Initial program 52.9%
tan-sum99.7%
div-inv99.6%
Applied egg-rr99.6%
associate-*r/99.7%
*-rgt-identity99.7%
Simplified99.7%
Taylor expanded in x around 0 56.4%
Final simplification72.9%
(FPCore (x eps) :precision binary64 (if (or (<= eps -0.00023) (not (<= eps 2.7e-5))) (/ (sin eps) (cos eps)) (* eps (+ (/ (pow (sin x) 2.0) (pow (cos x) 2.0)) 1.0))))
double code(double x, double eps) {
double tmp;
if ((eps <= -0.00023) || !(eps <= 2.7e-5)) {
tmp = sin(eps) / cos(eps);
} else {
tmp = eps * ((pow(sin(x), 2.0) / pow(cos(x), 2.0)) + 1.0);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-0.00023d0)) .or. (.not. (eps <= 2.7d-5))) then
tmp = sin(eps) / cos(eps)
else
tmp = eps * (((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -0.00023) || !(eps <= 2.7e-5)) {
tmp = Math.sin(eps) / Math.cos(eps);
} else {
tmp = eps * ((Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.0)) + 1.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -0.00023) or not (eps <= 2.7e-5): tmp = math.sin(eps) / math.cos(eps) else: tmp = eps * ((math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.0)) + 1.0) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -0.00023) || !(eps <= 2.7e-5)) tmp = Float64(sin(eps) / cos(eps)); else tmp = Float64(eps * Float64(Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -0.00023) || ~((eps <= 2.7e-5))) tmp = sin(eps) / cos(eps); else tmp = eps * (((sin(x) ^ 2.0) / (cos(x) ^ 2.0)) + 1.0); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -0.00023], N[Not[LessEqual[eps, 2.7e-5]], $MachinePrecision]], N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.00023 \lor \neg \left(\varepsilon \leq 2.7 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{\sin \varepsilon}{\cos \varepsilon}\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(\frac{{\sin x}^{2}}{{\cos x}^{2}} + 1\right)\\
\end{array}
\end{array}
if eps < -2.3000000000000001e-4 or 2.6999999999999999e-5 < eps Initial program 50.4%
tan-sum99.5%
div-inv99.5%
Applied egg-rr99.5%
associate-*r/99.5%
*-rgt-identity99.5%
Simplified99.5%
Taylor expanded in x around 0 53.1%
if -2.3000000000000001e-4 < eps < 2.6999999999999999e-5Initial program 33.7%
Taylor expanded in eps around 0 98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
Simplified98.0%
Final simplification72.9%
(FPCore (x eps) :precision binary64 (if (or (<= eps -7e-5) (not (<= eps 3.7e-5))) (- (tan eps) (tan x)) eps))
double code(double x, double eps) {
double tmp;
if ((eps <= -7e-5) || !(eps <= 3.7e-5)) {
tmp = tan(eps) - tan(x);
} else {
tmp = eps;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-7d-5)) .or. (.not. (eps <= 3.7d-5))) then
tmp = tan(eps) - tan(x)
else
tmp = eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -7e-5) || !(eps <= 3.7e-5)) {
tmp = Math.tan(eps) - Math.tan(x);
} else {
tmp = eps;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -7e-5) or not (eps <= 3.7e-5): tmp = math.tan(eps) - math.tan(x) else: tmp = eps return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -7e-5) || !(eps <= 3.7e-5)) tmp = Float64(tan(eps) - tan(x)); else tmp = eps; end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -7e-5) || ~((eps <= 3.7e-5))) tmp = tan(eps) - tan(x); else tmp = eps; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -7e-5], N[Not[LessEqual[eps, 3.7e-5]], $MachinePrecision]], N[(N[Tan[eps], $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], eps]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -7 \cdot 10^{-5} \lor \neg \left(\varepsilon \leq 3.7 \cdot 10^{-5}\right):\\
\;\;\;\;\tan \varepsilon - \tan x\\
\mathbf{else}:\\
\;\;\;\;\varepsilon\\
\end{array}
\end{array}
if eps < -6.9999999999999994e-5 or 3.69999999999999981e-5 < eps Initial program 50.4%
Taylor expanded in x around 0 52.7%
tan-quot53.0%
expm1-log1p-u40.1%
expm1-udef39.8%
Applied egg-rr39.8%
expm1-def40.1%
expm1-log1p53.0%
Simplified53.0%
if -6.9999999999999994e-5 < eps < 3.69999999999999981e-5Initial program 33.7%
tan-sum35.7%
clear-num35.3%
Applied egg-rr35.3%
clear-num35.4%
tan-sum33.4%
tan-quot33.5%
associate-/r/33.6%
Applied egg-rr33.6%
Taylor expanded in eps around 0 33.2%
Taylor expanded in eps around 0 61.5%
Final simplification56.8%
(FPCore (x eps) :precision binary64 (/ (sin eps) (cos eps)))
double code(double x, double eps) {
return sin(eps) / cos(eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin(eps) / cos(eps)
end function
public static double code(double x, double eps) {
return Math.sin(eps) / Math.cos(eps);
}
def code(x, eps): return math.sin(eps) / math.cos(eps)
function code(x, eps) return Float64(sin(eps) / cos(eps)) end
function tmp = code(x, eps) tmp = sin(eps) / cos(eps); end
code[x_, eps_] := N[(N[Sin[eps], $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\sin \varepsilon}{\cos \varepsilon}
\end{array}
Initial program 43.0%
tan-sum71.4%
div-inv71.3%
Applied egg-rr71.3%
associate-*r/71.4%
*-rgt-identity71.4%
Simplified71.4%
Taylor expanded in x around 0 56.8%
Final simplification56.8%
(FPCore (x eps) :precision binary64 (if (or (<= eps -3400000.0) (not (<= eps 2.8e-5))) (tan (+ eps x)) (sin eps)))
double code(double x, double eps) {
double tmp;
if ((eps <= -3400000.0) || !(eps <= 2.8e-5)) {
tmp = tan((eps + x));
} else {
tmp = sin(eps);
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-3400000.0d0)) .or. (.not. (eps <= 2.8d-5))) then
tmp = tan((eps + x))
else
tmp = sin(eps)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -3400000.0) || !(eps <= 2.8e-5)) {
tmp = Math.tan((eps + x));
} else {
tmp = Math.sin(eps);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -3400000.0) or not (eps <= 2.8e-5): tmp = math.tan((eps + x)) else: tmp = math.sin(eps) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -3400000.0) || !(eps <= 2.8e-5)) tmp = tan(Float64(eps + x)); else tmp = sin(eps); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -3400000.0) || ~((eps <= 2.8e-5))) tmp = tan((eps + x)); else tmp = sin(eps); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -3400000.0], N[Not[LessEqual[eps, 2.8e-5]], $MachinePrecision]], N[Tan[N[(eps + x), $MachinePrecision]], $MachinePrecision], N[Sin[eps], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3400000 \lor \neg \left(\varepsilon \leq 2.8 \cdot 10^{-5}\right):\\
\;\;\;\;\tan \left(\varepsilon + x\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \varepsilon\\
\end{array}
\end{array}
if eps < -3.4e6 or 2.79999999999999996e-5 < eps Initial program 51.0%
add-cube-cbrt50.6%
pow350.6%
Applied egg-rr50.6%
add-sqr-sqrt30.3%
sqrt-unprod35.3%
pow235.3%
Applied egg-rr35.3%
unpow235.3%
rem-sqrt-square35.3%
+-commutative35.3%
Simplified35.3%
Taylor expanded in x around 0 30.9%
+-commutative30.9%
metadata-eval30.9%
pow-sqr30.6%
fabs-sqr30.6%
pow-sqr30.9%
metadata-eval30.9%
unpow1/350.6%
rem-cube-cbrt51.6%
Simplified51.6%
if -3.4e6 < eps < 2.79999999999999996e-5Initial program 33.2%
tan-sum36.8%
clear-num36.4%
Applied egg-rr36.4%
clear-num36.5%
tan-sum32.9%
tan-quot32.9%
associate-/r/33.1%
Applied egg-rr33.1%
Taylor expanded in eps around 0 32.7%
Taylor expanded in x around 0 60.6%
Final simplification55.6%
(FPCore (x eps) :precision binary64 (sin eps))
double code(double x, double eps) {
return sin(eps);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = sin(eps)
end function
public static double code(double x, double eps) {
return Math.sin(eps);
}
def code(x, eps): return math.sin(eps)
function code(x, eps) return sin(eps) end
function tmp = code(x, eps) tmp = sin(eps); end
code[x_, eps_] := N[Sin[eps], $MachinePrecision]
\begin{array}{l}
\\
\sin \varepsilon
\end{array}
Initial program 43.0%
tan-sum71.4%
clear-num71.1%
Applied egg-rr71.1%
clear-num71.1%
tan-sum42.9%
tan-quot42.8%
associate-/r/42.9%
Applied egg-rr42.9%
Taylor expanded in eps around 0 20.4%
Taylor expanded in x around 0 32.9%
Final simplification32.9%
(FPCore (x eps) :precision binary64 0.0)
double code(double x, double eps) {
return 0.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 0.0d0
end function
public static double code(double x, double eps) {
return 0.0;
}
def code(x, eps): return 0.0
function code(x, eps) return 0.0 end
function tmp = code(x, eps) tmp = 0.0; end
code[x_, eps_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 43.0%
add-cube-cbrt42.1%
pow342.2%
Applied egg-rr42.2%
Taylor expanded in eps around 0 4.1%
pow-base-14.1%
*-lft-identity4.1%
+-inverses4.1%
Simplified4.1%
Final simplification4.1%
(FPCore (x eps) :precision binary64 eps)
double code(double x, double eps) {
return eps;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps
end function
public static double code(double x, double eps) {
return eps;
}
def code(x, eps): return eps
function code(x, eps) return eps end
function tmp = code(x, eps) tmp = eps; end
code[x_, eps_] := eps
\begin{array}{l}
\\
\varepsilon
\end{array}
Initial program 43.0%
tan-sum71.4%
clear-num71.1%
Applied egg-rr71.1%
clear-num71.1%
tan-sum42.9%
tan-quot42.8%
associate-/r/42.9%
Applied egg-rr42.9%
Taylor expanded in eps around 0 20.4%
Taylor expanded in eps around 0 29.4%
Final simplification29.4%
(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 2023318
(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)))