
(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 17 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) 2.0))
(t_1 (* (tan x) (tan eps)))
(t_2 (- 1.0 t_1))
(t_3 (+ (tan x) (tan eps)))
(t_4 (pow (sin x) 2.0))
(t_5 (/ t_4 t_0))
(t_6 (+ 1.0 t_5)))
(if (<= eps -4.8e-5)
(- (/ t_3 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 3.3e-6)
(+
(*
(pow eps 3.0)
(-
(+
(/ (* t_4 t_6) t_0)
(- (* -0.5 (- -1.0 t_5)) (* 0.16666666666666666 t_5)))
0.16666666666666666))
(+ (/ (* (pow eps 2.0) (* (sin x) t_6)) (cos x)) (* eps t_6)))
(/
(+
(fma t_2 (- (sin x)) (* t_3 (cos x)))
(fma (sin x) (+ -1.0 t_1) (* (sin x) t_2)))
(* (cos x) t_2))))))
double code(double x, double eps) {
double t_0 = pow(cos(x), 2.0);
double t_1 = tan(x) * tan(eps);
double t_2 = 1.0 - t_1;
double t_3 = tan(x) + tan(eps);
double t_4 = pow(sin(x), 2.0);
double t_5 = t_4 / t_0;
double t_6 = 1.0 + t_5;
double tmp;
if (eps <= -4.8e-5) {
tmp = (t_3 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 3.3e-6) {
tmp = (pow(eps, 3.0) * ((((t_4 * t_6) / t_0) + ((-0.5 * (-1.0 - t_5)) - (0.16666666666666666 * t_5))) - 0.16666666666666666)) + (((pow(eps, 2.0) * (sin(x) * t_6)) / cos(x)) + (eps * t_6));
} else {
tmp = (fma(t_2, -sin(x), (t_3 * cos(x))) + fma(sin(x), (-1.0 + t_1), (sin(x) * t_2))) / (cos(x) * t_2);
}
return tmp;
}
function code(x, eps) t_0 = cos(x) ^ 2.0 t_1 = Float64(tan(x) * tan(eps)) t_2 = Float64(1.0 - t_1) t_3 = Float64(tan(x) + tan(eps)) t_4 = sin(x) ^ 2.0 t_5 = Float64(t_4 / t_0) t_6 = Float64(1.0 + t_5) tmp = 0.0 if (eps <= -4.8e-5) tmp = Float64(Float64(t_3 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 3.3e-6) tmp = Float64(Float64((eps ^ 3.0) * Float64(Float64(Float64(Float64(t_4 * t_6) / t_0) + Float64(Float64(-0.5 * Float64(-1.0 - t_5)) - Float64(0.16666666666666666 * t_5))) - 0.16666666666666666)) + Float64(Float64(Float64((eps ^ 2.0) * Float64(sin(x) * t_6)) / cos(x)) + Float64(eps * t_6))); else tmp = Float64(Float64(fma(t_2, Float64(-sin(x)), Float64(t_3 * cos(x))) + fma(sin(x), Float64(-1.0 + t_1), Float64(sin(x) * t_2))) / Float64(cos(x) * t_2)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$4 / t$95$0), $MachinePrecision]}, Block[{t$95$6 = N[(1.0 + t$95$5), $MachinePrecision]}, If[LessEqual[eps, -4.8e-5], N[(N[(t$95$3 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.3e-6], N[(N[(N[Power[eps, 3.0], $MachinePrecision] * N[(N[(N[(N[(t$95$4 * t$95$6), $MachinePrecision] / t$95$0), $MachinePrecision] + N[(N[(-0.5 * N[(-1.0 - t$95$5), $MachinePrecision]), $MachinePrecision] - N[(0.16666666666666666 * t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[Power[eps, 2.0], $MachinePrecision] * N[(N[Sin[x], $MachinePrecision] * t$95$6), $MachinePrecision]), $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision] + N[(eps * t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(t$95$2 * (-N[Sin[x], $MachinePrecision]) + N[(t$95$3 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(-1.0 + t$95$1), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\cos x}^{2}\\
t_1 := \tan x \cdot \tan \varepsilon\\
t_2 := 1 - t_1\\
t_3 := \tan x + \tan \varepsilon\\
t_4 := {\sin x}^{2}\\
t_5 := \frac{t_4}{t_0}\\
t_6 := 1 + t_5\\
\mathbf{if}\;\varepsilon \leq -4.8 \cdot 10^{-5}:\\
\;\;\;\;\frac{t_3}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.3 \cdot 10^{-6}:\\
\;\;\;\;{\varepsilon}^{3} \cdot \left(\left(\frac{t_4 \cdot t_6}{t_0} + \left(-0.5 \cdot \left(-1 - t_5\right) - 0.16666666666666666 \cdot t_5\right)\right) - 0.16666666666666666\right) + \left(\frac{{\varepsilon}^{2} \cdot \left(\sin x \cdot t_6\right)}{\cos x} + \varepsilon \cdot t_6\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t_2, -\sin x, t_3 \cdot \cos x\right) + \mathsf{fma}\left(\sin x, -1 + t_1, \sin x \cdot t_2\right)}{\cos x \cdot t_2}\\
\end{array}
\end{array}
if eps < -4.8000000000000001e-5Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -4.8000000000000001e-5 < eps < 3.30000000000000017e-6Initial program 29.6%
Taylor expanded in eps around 0 99.6%
if 3.30000000000000017e-6 < eps Initial program 52.8%
tan-sum99.4%
tan-quot99.3%
frac-sub99.4%
Applied egg-rr99.4%
prod-diff99.5%
*-commutative99.5%
fma-neg99.4%
*-commutative99.4%
Applied egg-rr99.4%
cancel-sign-sub-inv99.4%
+-commutative99.4%
distribute-lft-neg-in99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
*-commutative99.4%
fma-udef99.3%
Simplified99.4%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps)))
(t_1 (* (tan x) (tan eps)))
(t_2 (- 1.0 t_1)))
(if (<= eps -3.6e-7)
(- (/ t_0 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 6e-7)
(+
(* eps (+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(*
(pow eps 2.0)
(+ (/ (sin x) (cos x)) (/ (pow (sin x) 3.0) (pow (cos x) 3.0)))))
(/
(+
(fma t_2 (- (sin x)) (* t_0 (cos x)))
(fma (sin x) (+ -1.0 t_1) (* (sin x) t_2)))
(* (cos x) t_2))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double t_1 = tan(x) * tan(eps);
double t_2 = 1.0 - t_1;
double tmp;
if (eps <= -3.6e-7) {
tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 6e-7) {
tmp = (eps * (1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.0)))) + (pow(eps, 2.0) * ((sin(x) / cos(x)) + (pow(sin(x), 3.0) / pow(cos(x), 3.0))));
} else {
tmp = (fma(t_2, -sin(x), (t_0 * cos(x))) + fma(sin(x), (-1.0 + t_1), (sin(x) * t_2))) / (cos(x) * t_2);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) t_1 = Float64(tan(x) * tan(eps)) t_2 = Float64(1.0 - t_1) tmp = 0.0 if (eps <= -3.6e-7) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 6e-7) tmp = Float64(Float64(eps * Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))) + Float64((eps ^ 2.0) * Float64(Float64(sin(x) / cos(x)) + Float64((sin(x) ^ 3.0) / (cos(x) ^ 3.0))))); else tmp = Float64(Float64(fma(t_2, Float64(-sin(x)), Float64(t_0 * cos(x))) + fma(sin(x), Float64(-1.0 + t_1), Float64(sin(x) * t_2))) / Float64(cos(x) * t_2)); 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]}, Block[{t$95$2 = N[(1.0 - t$95$1), $MachinePrecision]}, If[LessEqual[eps, -3.6e-7], N[(N[(t$95$0 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6e-7], N[(N[(eps * N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $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[(N[(t$95$2 * (-N[Sin[x], $MachinePrecision]) + N[(t$95$0 * N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[(-1.0 + t$95$1), $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
t_1 := \tan x \cdot \tan \varepsilon\\
t_2 := 1 - t_1\\
\mathbf{if}\;\varepsilon \leq -3.6 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + {\varepsilon}^{2} \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(t_2, -\sin x, t_0 \cdot \cos x\right) + \mathsf{fma}\left(\sin x, -1 + t_1, \sin x \cdot t_2\right)}{\cos x \cdot t_2}\\
\end{array}
\end{array}
if eps < -3.59999999999999994e-7Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -3.59999999999999994e-7 < eps < 5.9999999999999997e-7Initial program 29.6%
tan-sum30.8%
div-inv30.8%
*-un-lft-identity30.8%
prod-diff30.8%
*-commutative30.8%
*-un-lft-identity30.8%
*-commutative30.8%
*-un-lft-identity30.8%
Applied egg-rr30.8%
+-commutative30.8%
fma-udef30.8%
associate-+r+30.8%
unsub-neg30.8%
Simplified30.8%
tan-quot30.8%
clear-num30.8%
un-div-inv30.8%
clear-num30.8%
tan-quot30.8%
Applied egg-rr30.8%
Taylor expanded in eps around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
if 5.9999999999999997e-7 < eps Initial program 52.8%
tan-sum99.4%
tan-quot99.3%
frac-sub99.4%
Applied egg-rr99.4%
prod-diff99.5%
*-commutative99.5%
fma-neg99.4%
*-commutative99.4%
Applied egg-rr99.4%
cancel-sign-sub-inv99.4%
+-commutative99.4%
distribute-lft-neg-in99.4%
distribute-rgt-neg-in99.4%
fma-def99.4%
*-commutative99.4%
fma-udef99.3%
Simplified99.4%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -1.35e-7)
(- (/ t_0 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 6e-7)
(+
(* eps (+ 1.0 (* (pow (sin x) 2.0) (pow (cos x) -2.0))))
(*
(pow eps 2.0)
(+ (/ (sin x) (cos x)) (/ (pow (sin x) 3.0) (pow (cos x) 3.0)))))
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -1.35e-7) {
tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 6e-7) {
tmp = (eps * (1.0 + (pow(sin(x), 2.0) * pow(cos(x), -2.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(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) :: t_0
real(8) :: tmp
t_0 = tan(x) + tan(eps)
if (eps <= (-1.35d-7)) then
tmp = (t_0 / (1.0d0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x)
else if (eps <= 6d-7) then
tmp = (eps * (1.0d0 + ((sin(x) ** 2.0d0) * (cos(x) ** (-2.0d0))))) + ((eps ** 2.0d0) * ((sin(x) / cos(x)) + ((sin(x) ** 3.0d0) / (cos(x) ** 3.0d0))))
else
tmp = (t_0 / (1.0d0 - (tan(x) * 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 <= -1.35e-7) {
tmp = (t_0 / (1.0 - ((Math.tan(x) * Math.sin(eps)) / Math.cos(eps)))) - Math.tan(x);
} else if (eps <= 6e-7) {
tmp = (eps * (1.0 + (Math.pow(Math.sin(x), 2.0) * Math.pow(Math.cos(x), -2.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(x) * Math.tan(eps)))) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.tan(x) + math.tan(eps) tmp = 0 if eps <= -1.35e-7: tmp = (t_0 / (1.0 - ((math.tan(x) * math.sin(eps)) / math.cos(eps)))) - math.tan(x) elif eps <= 6e-7: tmp = (eps * (1.0 + (math.pow(math.sin(x), 2.0) * math.pow(math.cos(x), -2.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(x) * math.tan(eps)))) - math.tan(x) return tmp
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -1.35e-7) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 6e-7) tmp = Float64(Float64(eps * Float64(1.0 + Float64((sin(x) ^ 2.0) * (cos(x) ^ -2.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(tan(x) * 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 <= -1.35e-7) tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x); elseif (eps <= 6e-7) tmp = (eps * (1.0 + ((sin(x) ^ 2.0) * (cos(x) ^ -2.0)))) + ((eps ^ 2.0) * ((sin(x) / cos(x)) + ((sin(x) ^ 3.0) / (cos(x) ^ 3.0)))); else tmp = (t_0 / (1.0 - (tan(x) * 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, -1.35e-7], N[(N[(t$95$0 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 6e-7], N[(N[(eps * N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[Cos[x], $MachinePrecision], -2.0], $MachinePrecision]), $MachinePrecision]), $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[Tan[x], $MachinePrecision] * N[Tan[eps], $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 -1.35 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 6 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(1 + {\sin x}^{2} \cdot {\cos x}^{-2}\right) + {\varepsilon}^{2} \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\end{array}
\end{array}
if eps < -1.35000000000000004e-7Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -1.35000000000000004e-7 < eps < 5.9999999999999997e-7Initial program 29.6%
tan-sum30.8%
div-inv30.8%
*-un-lft-identity30.8%
prod-diff30.8%
*-commutative30.8%
*-un-lft-identity30.8%
*-commutative30.8%
*-un-lft-identity30.8%
Applied egg-rr30.8%
+-commutative30.8%
fma-udef30.8%
associate-+r+30.8%
unsub-neg30.8%
Simplified30.8%
Taylor expanded in eps around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
Simplified99.5%
if 5.9999999999999997e-7 < eps Initial program 52.8%
tan-sum99.4%
div-inv99.2%
*-un-lft-identity99.2%
prod-diff99.2%
*-commutative99.2%
*-un-lft-identity99.2%
*-commutative99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
+-commutative99.2%
fma-udef99.2%
associate-+r+99.2%
unsub-neg99.2%
Simplified99.4%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -2.7e-7)
(- (/ t_0 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 3.9e-7)
(+
(* eps (+ 1.0 (/ (pow (sin x) 2.0) (pow (cos x) 2.0))))
(*
(pow eps 2.0)
(+ (/ (sin x) (cos x)) (/ (pow (sin x) 3.0) (pow (cos x) 3.0)))))
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -2.7e-7) {
tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 3.9e-7) {
tmp = (eps * (1.0 + (pow(sin(x), 2.0) / pow(cos(x), 2.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(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) :: t_0
real(8) :: tmp
t_0 = tan(x) + tan(eps)
if (eps <= (-2.7d-7)) then
tmp = (t_0 / (1.0d0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x)
else if (eps <= 3.9d-7) then
tmp = (eps * (1.0d0 + ((sin(x) ** 2.0d0) / (cos(x) ** 2.0d0)))) + ((eps ** 2.0d0) * ((sin(x) / cos(x)) + ((sin(x) ** 3.0d0) / (cos(x) ** 3.0d0))))
else
tmp = (t_0 / (1.0d0 - (tan(x) * 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 <= -2.7e-7) {
tmp = (t_0 / (1.0 - ((Math.tan(x) * Math.sin(eps)) / Math.cos(eps)))) - Math.tan(x);
} else if (eps <= 3.9e-7) {
tmp = (eps * (1.0 + (Math.pow(Math.sin(x), 2.0) / Math.pow(Math.cos(x), 2.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(x) * Math.tan(eps)))) - Math.tan(x);
}
return tmp;
}
def code(x, eps): t_0 = math.tan(x) + math.tan(eps) tmp = 0 if eps <= -2.7e-7: tmp = (t_0 / (1.0 - ((math.tan(x) * math.sin(eps)) / math.cos(eps)))) - math.tan(x) elif eps <= 3.9e-7: tmp = (eps * (1.0 + (math.pow(math.sin(x), 2.0) / math.pow(math.cos(x), 2.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(x) * math.tan(eps)))) - math.tan(x) return tmp
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -2.7e-7) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 3.9e-7) tmp = Float64(Float64(eps * Float64(1.0 + Float64((sin(x) ^ 2.0) / (cos(x) ^ 2.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(tan(x) * 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 <= -2.7e-7) tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x); elseif (eps <= 3.9e-7) tmp = (eps * (1.0 + ((sin(x) ^ 2.0) / (cos(x) ^ 2.0)))) + ((eps ^ 2.0) * ((sin(x) / cos(x)) + ((sin(x) ^ 3.0) / (cos(x) ^ 3.0)))); else tmp = (t_0 / (1.0 - (tan(x) * 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, -2.7e-7], N[(N[(t$95$0 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.9e-7], N[(N[(eps * N[(1.0 + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[Cos[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $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[Tan[x], $MachinePrecision] * N[Tan[eps], $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 -2.7 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.9 \cdot 10^{-7}:\\
\;\;\;\;\varepsilon \cdot \left(1 + \frac{{\sin x}^{2}}{{\cos x}^{2}}\right) + {\varepsilon}^{2} \cdot \left(\frac{\sin x}{\cos x} + \frac{{\sin x}^{3}}{{\cos x}^{3}}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\end{array}
\end{array}
if eps < -2.70000000000000009e-7Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -2.70000000000000009e-7 < eps < 3.90000000000000025e-7Initial program 29.6%
tan-sum30.8%
div-inv30.8%
*-un-lft-identity30.8%
prod-diff30.8%
*-commutative30.8%
*-un-lft-identity30.8%
*-commutative30.8%
*-un-lft-identity30.8%
Applied egg-rr30.8%
+-commutative30.8%
fma-udef30.8%
associate-+r+30.8%
unsub-neg30.8%
Simplified30.8%
tan-quot30.8%
clear-num30.8%
un-div-inv30.8%
clear-num30.8%
tan-quot30.8%
Applied egg-rr30.8%
Taylor expanded in eps around 0 99.6%
+-commutative99.6%
mul-1-neg99.6%
unsub-neg99.6%
cancel-sign-sub-inv99.6%
metadata-eval99.6%
*-lft-identity99.6%
Simplified99.6%
if 3.90000000000000025e-7 < eps Initial program 52.8%
tan-sum99.4%
div-inv99.2%
*-un-lft-identity99.2%
prod-diff99.2%
*-commutative99.2%
*-un-lft-identity99.2%
*-commutative99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
+-commutative99.2%
fma-udef99.2%
associate-+r+99.2%
unsub-neg99.2%
Simplified99.4%
Final simplification99.6%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))) (t_1 (- 1.0 (* (tan x) (tan eps)))))
(if (<= eps -8.9e-7)
(- (/ t_0 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 4.4e-7)
(/ (* eps (+ (cos x) (/ (pow (sin x) 2.0) (cos x)))) (* (cos x) t_1))
(- (/ 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 <= -8.9e-7) {
tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 4.4e-7) {
tmp = (eps * (cos(x) + (pow(sin(x), 2.0) / cos(x)))) / (cos(x) * t_1);
} 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 <= (-8.9d-7)) then
tmp = (t_0 / (1.0d0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x)
else if (eps <= 4.4d-7) then
tmp = (eps * (cos(x) + ((sin(x) ** 2.0d0) / cos(x)))) / (cos(x) * t_1)
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 <= -8.9e-7) {
tmp = (t_0 / (1.0 - ((Math.tan(x) * Math.sin(eps)) / Math.cos(eps)))) - Math.tan(x);
} else if (eps <= 4.4e-7) {
tmp = (eps * (Math.cos(x) + (Math.pow(Math.sin(x), 2.0) / Math.cos(x)))) / (Math.cos(x) * t_1);
} 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 <= -8.9e-7: tmp = (t_0 / (1.0 - ((math.tan(x) * math.sin(eps)) / math.cos(eps)))) - math.tan(x) elif eps <= 4.4e-7: tmp = (eps * (math.cos(x) + (math.pow(math.sin(x), 2.0) / math.cos(x)))) / (math.cos(x) * t_1) 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 <= -8.9e-7) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 4.4e-7) tmp = Float64(Float64(eps * Float64(cos(x) + Float64((sin(x) ^ 2.0) / cos(x)))) / Float64(cos(x) * t_1)); 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 <= -8.9e-7) tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x); elseif (eps <= 4.4e-7) tmp = (eps * (cos(x) + ((sin(x) ^ 2.0) / cos(x)))) / (cos(x) * t_1); 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, -8.9e-7], N[(N[(t$95$0 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.4e-7], N[(N[(eps * N[(N[Cos[x], $MachinePrecision] + N[(N[Power[N[Sin[x], $MachinePrecision], 2.0], $MachinePrecision] / N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Cos[x], $MachinePrecision] * t$95$1), $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 -8.9 \cdot 10^{-7}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{-7}:\\
\;\;\;\;\frac{\varepsilon \cdot \left(\cos x + \frac{{\sin x}^{2}}{\cos x}\right)}{\cos x \cdot t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{t_1} - \tan x\\
\end{array}
\end{array}
if eps < -8.899999999999999e-7Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -8.899999999999999e-7 < eps < 4.4000000000000002e-7Initial program 29.6%
tan-sum30.8%
tan-quot30.8%
frac-sub30.7%
Applied egg-rr30.7%
Taylor expanded in eps around 0 99.5%
sub-neg99.5%
mul-1-neg99.5%
remove-double-neg99.5%
Simplified99.5%
if 4.4000000000000002e-7 < eps Initial program 52.8%
tan-sum99.4%
div-inv99.2%
*-un-lft-identity99.2%
prod-diff99.2%
*-commutative99.2%
*-un-lft-identity99.2%
*-commutative99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
+-commutative99.2%
fma-udef99.2%
associate-+r+99.2%
unsub-neg99.2%
Simplified99.4%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -1.95e-9)
(- (/ t_0 (- 1.0 (+ -1.0 (fma (tan x) (tan eps) 1.0)))) (tan x))
(if (<= eps 2.6e-9)
(fma eps (pow (tan x) 2.0) eps)
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -1.95e-9) {
tmp = (t_0 / (1.0 - (-1.0 + fma(tan(x), tan(eps), 1.0)))) - tan(x);
} else if (eps <= 2.6e-9) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -1.95e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(-1.0 + fma(tan(x), tan(eps), 1.0)))) - tan(x)); elseif (eps <= 2.6e-9) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - 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, -1.95e-9], N[(N[(t$95$0 / N[(1.0 - N[(-1.0 + N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 2.6e-9], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], 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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -1.95 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \left(-1 + \mathsf{fma}\left(\tan x, \tan \varepsilon, 1\right)\right)} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 2.6 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\end{array}
\end{array}
if eps < -1.9500000000000001e-9Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
expm1-log1p-u81.2%
expm1-udef81.2%
log1p-udef81.1%
add-exp-log99.5%
Applied egg-rr99.5%
sub-neg99.5%
+-commutative99.5%
fma-def99.6%
metadata-eval99.6%
Simplified99.6%
if -1.9500000000000001e-9 < eps < 2.6000000000000001e-9Initial program 29.8%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
Simplified99.2%
distribute-rgt-in99.3%
*-un-lft-identity99.3%
unpow299.3%
unpow299.3%
frac-times99.3%
tan-quot99.3%
tan-quot99.3%
pow299.3%
Applied egg-rr99.3%
+-commutative99.3%
*-commutative99.3%
fma-def99.4%
Simplified99.4%
if 2.6000000000000001e-9 < eps Initial program 51.9%
tan-sum98.7%
div-inv98.5%
*-un-lft-identity98.5%
prod-diff98.6%
*-commutative98.6%
*-un-lft-identity98.6%
*-commutative98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
+-commutative98.6%
fma-udef98.5%
associate-+r+98.5%
unsub-neg98.5%
Simplified98.7%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -3.7e-9)
(- (/ t_0 (- 1.0 (/ (* (tan x) (sin eps)) (cos eps)))) (tan x))
(if (<= eps 4.4e-9)
(fma eps (pow (tan x) 2.0) eps)
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -3.7e-9) {
tmp = (t_0 / (1.0 - ((tan(x) * sin(eps)) / cos(eps)))) - tan(x);
} else if (eps <= 4.4e-9) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -3.7e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(Float64(tan(x) * sin(eps)) / cos(eps)))) - tan(x)); elseif (eps <= 4.4e-9) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - 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.7e-9], N[(N[(t$95$0 / N[(1.0 - N[(N[(N[Tan[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision] / N[Cos[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 4.4e-9], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], 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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -3.7 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan x \cdot \sin \varepsilon}{\cos \varepsilon}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 4.4 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\end{array}
\end{array}
if eps < -3.7e-9Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
tan-quot99.5%
tan-quot99.5%
associate-*r/99.7%
Applied egg-rr99.7%
if -3.7e-9 < eps < 4.3999999999999997e-9Initial program 29.8%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
Simplified99.2%
distribute-rgt-in99.3%
*-un-lft-identity99.3%
unpow299.3%
unpow299.3%
frac-times99.3%
tan-quot99.3%
tan-quot99.3%
pow299.3%
Applied egg-rr99.3%
+-commutative99.3%
*-commutative99.3%
fma-def99.4%
Simplified99.4%
if 4.3999999999999997e-9 < eps Initial program 51.9%
tan-sum98.7%
div-inv98.5%
*-un-lft-identity98.5%
prod-diff98.6%
*-commutative98.6%
*-un-lft-identity98.6%
*-commutative98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
+-commutative98.6%
fma-udef98.5%
associate-+r+98.5%
unsub-neg98.5%
Simplified98.7%
Final simplification99.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -2.9e-9) (not (<= eps 3.3e-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.9e-9) || !(eps <= 3.3e-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.9e-9) || !(eps <= 3.3e-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.9e-9], N[Not[LessEqual[eps, 3.3e-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.9 \cdot 10^{-9} \lor \neg \left(\varepsilon \leq 3.3 \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.89999999999999991e-9 or 3.30000000000000018e-9 < eps Initial program 53.7%
tan-sum99.2%
div-inv99.0%
*-un-lft-identity99.0%
prod-diff99.1%
*-commutative99.1%
*-un-lft-identity99.1%
*-commutative99.1%
*-un-lft-identity99.1%
Applied egg-rr99.1%
+-commutative99.1%
fma-udef99.0%
associate-+r+99.0%
unsub-neg99.0%
Simplified99.2%
if -2.89999999999999991e-9 < eps < 3.30000000000000018e-9Initial program 29.8%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
Simplified99.2%
distribute-rgt-in99.3%
*-un-lft-identity99.3%
unpow299.3%
unpow299.3%
frac-times99.3%
tan-quot99.3%
tan-quot99.3%
pow299.3%
Applied egg-rr99.3%
+-commutative99.3%
*-commutative99.3%
fma-def99.4%
Simplified99.4%
Final simplification99.3%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -4.6e-9)
(- (/ t_0 (- 1.0 (/ (tan eps) (/ 1.0 (tan x))))) (tan x))
(if (<= eps 2.8e-9)
(fma eps (pow (tan x) 2.0) eps)
(- (/ t_0 (- 1.0 (* (tan x) (tan eps)))) (tan x))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -4.6e-9) {
tmp = (t_0 / (1.0 - (tan(eps) / (1.0 / tan(x))))) - tan(x);
} else if (eps <= 2.8e-9) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = (t_0 / (1.0 - (tan(x) * tan(eps)))) - tan(x);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -4.6e-9) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(eps) / Float64(1.0 / tan(x))))) - tan(x)); elseif (eps <= 2.8e-9) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(tan(x) * tan(eps)))) - 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.6e-9], N[(N[(t$95$0 / N[(1.0 - N[(N[Tan[eps], $MachinePrecision] / N[(1.0 / N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 2.8e-9], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], 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]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -4.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{t_0}{1 - \frac{\tan \varepsilon}{\frac{1}{\tan x}}} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 2.8 \cdot 10^{-9}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{t_0}{1 - \tan x \cdot \tan \varepsilon} - \tan x\\
\end{array}
\end{array}
if eps < -4.5999999999999998e-9Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
clear-num99.5%
associate-*l/99.5%
*-un-lft-identity99.5%
clear-num99.6%
tan-quot99.6%
Applied egg-rr99.6%
if -4.5999999999999998e-9 < eps < 2.79999999999999984e-9Initial program 29.8%
Taylor expanded in eps around 0 99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
Simplified99.2%
distribute-rgt-in99.3%
*-un-lft-identity99.3%
unpow299.3%
unpow299.3%
frac-times99.3%
tan-quot99.3%
tan-quot99.3%
pow299.3%
Applied egg-rr99.3%
+-commutative99.3%
*-commutative99.3%
fma-def99.4%
Simplified99.4%
if 2.79999999999999984e-9 < eps Initial program 51.9%
tan-sum98.7%
div-inv98.5%
*-un-lft-identity98.5%
prod-diff98.6%
*-commutative98.6%
*-un-lft-identity98.6%
*-commutative98.6%
*-un-lft-identity98.6%
Applied egg-rr98.6%
+-commutative98.6%
fma-udef98.5%
associate-+r+98.5%
unsub-neg98.5%
Simplified98.7%
Final simplification99.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -8.5e-5) (not (<= eps 1.75e-6))) (- (/ (+ (tan x) (tan eps)) (- 1.0 (* x (tan eps)))) (tan x)) (fma eps (pow (tan x) 2.0) eps)))
double code(double x, double eps) {
double tmp;
if ((eps <= -8.5e-5) || !(eps <= 1.75e-6)) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (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 <= -8.5e-5) || !(eps <= 1.75e-6)) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(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, -8.5e-5], N[Not[LessEqual[eps, 1.75e-6]], $MachinePrecision]], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(x * 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 -8.5 \cdot 10^{-5} \lor \neg \left(\varepsilon \leq 1.75 \cdot 10^{-6}\right):\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - x \cdot \tan \varepsilon} - \tan x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\end{array}
\end{array}
if eps < -8.500000000000001e-5 or 1.74999999999999997e-6 < eps Initial program 54.1%
tan-sum99.5%
div-inv99.3%
*-un-lft-identity99.3%
prod-diff99.4%
*-commutative99.4%
*-un-lft-identity99.4%
*-commutative99.4%
*-un-lft-identity99.4%
Applied egg-rr99.4%
+-commutative99.4%
fma-udef99.3%
associate-+r+99.3%
unsub-neg99.3%
Simplified99.5%
*-commutative99.5%
tan-quot99.4%
clear-num99.4%
tan-quot99.4%
frac-times99.4%
*-un-lft-identity99.4%
clear-num99.3%
tan-quot99.4%
Applied egg-rr99.4%
*-commutative99.4%
*-rgt-identity99.4%
times-frac99.4%
remove-double-div99.5%
Simplified99.5%
Taylor expanded in x around 0 57.8%
if -8.500000000000001e-5 < eps < 1.74999999999999997e-6Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
unpow299.0%
unpow299.0%
frac-times98.9%
tan-quot99.0%
tan-quot99.0%
pow299.0%
Applied egg-rr99.0%
+-commutative99.0%
*-commutative99.0%
fma-def99.0%
Simplified99.0%
Final simplification77.8%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (+ (tan x) (tan eps))))
(if (<= eps -5e-6)
(- (/ t_0 (- 1.0 (* x (tan eps)))) (tan x))
(if (<= eps 1.4e-6)
(fma eps (pow (tan x) 2.0) eps)
(/ 1.0 (/ (- 1.0 (* (tan x) (tan eps))) t_0))))))
double code(double x, double eps) {
double t_0 = tan(x) + tan(eps);
double tmp;
if (eps <= -5e-6) {
tmp = (t_0 / (1.0 - (x * tan(eps)))) - tan(x);
} else if (eps <= 1.4e-6) {
tmp = fma(eps, pow(tan(x), 2.0), eps);
} else {
tmp = 1.0 / ((1.0 - (tan(x) * tan(eps))) / t_0);
}
return tmp;
}
function code(x, eps) t_0 = Float64(tan(x) + tan(eps)) tmp = 0.0 if (eps <= -5e-6) tmp = Float64(Float64(t_0 / Float64(1.0 - Float64(x * tan(eps)))) - tan(x)); elseif (eps <= 1.4e-6) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(1.0 / Float64(Float64(1.0 - Float64(tan(x) * tan(eps))) / t_0)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -5e-6], N[(N[(t$95$0 / N[(1.0 - N[(x * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 1.4e-6], N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision] + eps), $MachinePrecision], N[(1.0 / N[(N[(1.0 - N[(N[Tan[x], $MachinePrecision] * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \tan x + \tan \varepsilon\\
\mathbf{if}\;\varepsilon \leq -5 \cdot 10^{-6}:\\
\;\;\;\;\frac{t_0}{1 - x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{1 - \tan x \cdot \tan \varepsilon}{t_0}}\\
\end{array}
\end{array}
if eps < -5.00000000000000041e-6Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
Taylor expanded in x around 0 59.2%
if -5.00000000000000041e-6 < eps < 1.39999999999999994e-6Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
unpow299.0%
unpow299.0%
frac-times98.9%
tan-quot99.0%
tan-quot99.0%
pow299.0%
Applied egg-rr99.0%
+-commutative99.0%
*-commutative99.0%
fma-def99.0%
Simplified99.0%
if 1.39999999999999994e-6 < eps Initial program 52.8%
tan-sum99.4%
div-inv99.2%
*-un-lft-identity99.2%
prod-diff99.2%
*-commutative99.2%
*-un-lft-identity99.2%
*-commutative99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
+-commutative99.2%
fma-udef99.2%
associate-+r+99.2%
unsub-neg99.2%
Simplified99.4%
tan-sum52.8%
add-sqr-sqrt30.3%
sqrt-unprod34.6%
pow234.6%
Applied egg-rr34.6%
unpow234.6%
rem-sqrt-square34.6%
+-commutative34.6%
Simplified34.6%
Taylor expanded in x around 0 34.4%
+-commutative34.4%
rem-square-sqrt30.8%
fabs-sqr30.8%
rem-square-sqrt54.0%
+-commutative54.0%
Simplified54.0%
+-commutative54.0%
tan-sum56.1%
clear-num55.9%
Applied egg-rr55.9%
Final simplification77.8%
(FPCore (x eps)
:precision binary64
(if (<= eps -1.1e-5)
(- (/ (+ (tan x) (tan eps)) (- 1.0 (* x (tan eps)))) (tan x))
(if (<= eps 3.3e-6)
(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 <= -1.1e-5) {
tmp = ((tan(x) + tan(eps)) / (1.0 - (x * tan(eps)))) - tan(x);
} else if (eps <= 3.3e-6) {
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 <= -1.1e-5) tmp = Float64(Float64(Float64(tan(x) + tan(eps)) / Float64(1.0 - Float64(x * tan(eps)))) - tan(x)); elseif (eps <= 3.3e-6) tmp = fma(eps, (tan(x) ^ 2.0), eps); else tmp = Float64(Float64(Float64(-tan(x)) - tan(eps)) / Float64(-1.0 + Float64(tan(x) * tan(eps)))); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -1.1e-5], N[(N[(N[(N[Tan[x], $MachinePrecision] + N[Tan[eps], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(x * N[Tan[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Tan[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 3.3e-6], 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 -1.1 \cdot 10^{-5}:\\
\;\;\;\;\frac{\tan x + \tan \varepsilon}{1 - x \cdot \tan \varepsilon} - \tan x\\
\mathbf{elif}\;\varepsilon \leq 3.3 \cdot 10^{-6}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(-\tan x\right) - \tan \varepsilon}{-1 + \tan x \cdot \tan \varepsilon}\\
\end{array}
\end{array}
if eps < -1.1e-5Initial program 55.0%
tan-sum99.5%
div-inv99.4%
*-un-lft-identity99.4%
prod-diff99.5%
*-commutative99.5%
*-un-lft-identity99.5%
*-commutative99.5%
*-un-lft-identity99.5%
Applied egg-rr99.5%
+-commutative99.5%
fma-udef99.4%
associate-+r+99.4%
unsub-neg99.4%
Simplified99.5%
*-commutative99.5%
tan-quot99.5%
clear-num99.5%
tan-quot99.5%
frac-times99.5%
*-un-lft-identity99.5%
clear-num99.4%
tan-quot99.5%
Applied egg-rr99.5%
*-commutative99.5%
*-rgt-identity99.5%
times-frac99.6%
remove-double-div99.6%
Simplified99.6%
Taylor expanded in x around 0 59.2%
if -1.1e-5 < eps < 3.30000000000000017e-6Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
unpow299.0%
unpow299.0%
frac-times98.9%
tan-quot99.0%
tan-quot99.0%
pow299.0%
Applied egg-rr99.0%
+-commutative99.0%
*-commutative99.0%
fma-def99.0%
Simplified99.0%
if 3.30000000000000017e-6 < eps Initial program 52.8%
tan-sum99.4%
div-inv99.2%
*-un-lft-identity99.2%
prod-diff99.2%
*-commutative99.2%
*-un-lft-identity99.2%
*-commutative99.2%
*-un-lft-identity99.2%
Applied egg-rr99.2%
+-commutative99.2%
fma-udef99.2%
associate-+r+99.2%
unsub-neg99.2%
Simplified99.4%
tan-sum52.8%
add-sqr-sqrt30.3%
sqrt-unprod34.6%
pow234.6%
Applied egg-rr34.6%
unpow234.6%
rem-sqrt-square34.6%
+-commutative34.6%
Simplified34.6%
Taylor expanded in x around 0 34.4%
+-commutative34.4%
rem-square-sqrt30.8%
fabs-sqr30.8%
rem-square-sqrt54.0%
+-commutative54.0%
Simplified54.0%
+-commutative54.0%
tan-sum56.1%
frac-2neg56.1%
Applied egg-rr56.1%
Final simplification77.8%
(FPCore (x eps) :precision binary64 (if (or (<= eps -1.9e-6) (not (<= eps 1.8e-6))) (tan eps) (fma eps (pow (tan x) 2.0) eps)))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.9e-6) || !(eps <= 1.8e-6)) {
tmp = tan(eps);
} else {
tmp = fma(eps, pow(tan(x), 2.0), eps);
}
return tmp;
}
function code(x, eps) tmp = 0.0 if ((eps <= -1.9e-6) || !(eps <= 1.8e-6)) tmp = tan(eps); else tmp = fma(eps, (tan(x) ^ 2.0), eps); end return tmp end
code[x_, eps_] := If[Or[LessEqual[eps, -1.9e-6], N[Not[LessEqual[eps, 1.8e-6]], $MachinePrecision]], N[Tan[eps], $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.9 \cdot 10^{-6} \lor \neg \left(\varepsilon \leq 1.8 \cdot 10^{-6}\right):\\
\;\;\;\;\tan \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\varepsilon, {\tan x}^{2}, \varepsilon\right)\\
\end{array}
\end{array}
if eps < -1.9e-6 or 1.79999999999999992e-6 < eps Initial program 54.1%
Taylor expanded in x around 0 56.8%
tan-quot57.0%
expm1-log1p-u45.8%
expm1-udef45.3%
Applied egg-rr45.3%
expm1-def45.8%
expm1-log1p57.0%
Simplified57.0%
if -1.9e-6 < eps < 1.79999999999999992e-6Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
unpow299.0%
unpow299.0%
frac-times98.9%
tan-quot99.0%
tan-quot99.0%
pow299.0%
Applied egg-rr99.0%
+-commutative99.0%
*-commutative99.0%
fma-def99.0%
Simplified99.0%
Final simplification77.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -1.65e-5) (not (<= eps 3.1e-6))) (tan eps) (* eps (+ 1.0 (pow (tan x) 2.0)))))
double code(double x, double eps) {
double tmp;
if ((eps <= -1.65e-5) || !(eps <= 3.1e-6)) {
tmp = tan(eps);
} else {
tmp = eps * (1.0 + pow(tan(x), 2.0));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-1.65d-5)) .or. (.not. (eps <= 3.1d-6))) then
tmp = tan(eps)
else
tmp = eps * (1.0d0 + (tan(x) ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -1.65e-5) || !(eps <= 3.1e-6)) {
tmp = Math.tan(eps);
} else {
tmp = eps * (1.0 + Math.pow(Math.tan(x), 2.0));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -1.65e-5) or not (eps <= 3.1e-6): tmp = math.tan(eps) else: tmp = eps * (1.0 + math.pow(math.tan(x), 2.0)) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -1.65e-5) || !(eps <= 3.1e-6)) tmp = tan(eps); else tmp = Float64(eps * Float64(1.0 + (tan(x) ^ 2.0))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -1.65e-5) || ~((eps <= 3.1e-6))) tmp = tan(eps); else tmp = eps * (1.0 + (tan(x) ^ 2.0)); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -1.65e-5], N[Not[LessEqual[eps, 3.1e-6]], $MachinePrecision]], N[Tan[eps], $MachinePrecision], N[(eps * N[(1.0 + N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -1.65 \cdot 10^{-5} \lor \neg \left(\varepsilon \leq 3.1 \cdot 10^{-6}\right):\\
\;\;\;\;\tan \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\varepsilon \cdot \left(1 + {\tan x}^{2}\right)\\
\end{array}
\end{array}
if eps < -1.6500000000000001e-5 or 3.1e-6 < eps Initial program 54.1%
Taylor expanded in x around 0 56.8%
tan-quot57.0%
expm1-log1p-u45.8%
expm1-udef45.3%
Applied egg-rr45.3%
expm1-def45.8%
expm1-log1p57.0%
Simplified57.0%
if -1.6500000000000001e-5 < eps < 3.1e-6Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
unpow298.9%
unpow298.9%
frac-times98.9%
tan-quot98.9%
tan-quot98.9%
Applied egg-rr98.9%
unpow298.9%
Simplified98.9%
Final simplification77.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -3.3e-5) (not (<= eps 1e-6))) (tan eps) (+ eps (* eps (pow (tan x) 2.0)))))
double code(double x, double eps) {
double tmp;
if ((eps <= -3.3e-5) || !(eps <= 1e-6)) {
tmp = tan(eps);
} else {
tmp = eps + (eps * pow(tan(x), 2.0));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-3.3d-5)) .or. (.not. (eps <= 1d-6))) then
tmp = tan(eps)
else
tmp = eps + (eps * (tan(x) ** 2.0d0))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -3.3e-5) || !(eps <= 1e-6)) {
tmp = Math.tan(eps);
} else {
tmp = eps + (eps * Math.pow(Math.tan(x), 2.0));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -3.3e-5) or not (eps <= 1e-6): tmp = math.tan(eps) else: tmp = eps + (eps * math.pow(math.tan(x), 2.0)) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -3.3e-5) || !(eps <= 1e-6)) tmp = tan(eps); else tmp = Float64(eps + Float64(eps * (tan(x) ^ 2.0))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -3.3e-5) || ~((eps <= 1e-6))) tmp = tan(eps); else tmp = eps + (eps * (tan(x) ^ 2.0)); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -3.3e-5], N[Not[LessEqual[eps, 1e-6]], $MachinePrecision]], N[Tan[eps], $MachinePrecision], N[(eps + N[(eps * N[Power[N[Tan[x], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -3.3 \cdot 10^{-5} \lor \neg \left(\varepsilon \leq 10^{-6}\right):\\
\;\;\;\;\tan \varepsilon\\
\mathbf{else}:\\
\;\;\;\;\varepsilon + \varepsilon \cdot {\tan x}^{2}\\
\end{array}
\end{array}
if eps < -3.3000000000000003e-5 or 9.99999999999999955e-7 < eps Initial program 54.1%
Taylor expanded in x around 0 56.8%
tan-quot57.0%
expm1-log1p-u45.8%
expm1-udef45.3%
Applied egg-rr45.3%
expm1-def45.8%
expm1-log1p57.0%
Simplified57.0%
if -3.3000000000000003e-5 < eps < 9.99999999999999955e-7Initial program 29.6%
Taylor expanded in eps around 0 98.9%
cancel-sign-sub-inv98.9%
metadata-eval98.9%
*-lft-identity98.9%
Simplified98.9%
distribute-rgt-in99.0%
*-un-lft-identity99.0%
unpow299.0%
unpow299.0%
frac-times98.9%
tan-quot99.0%
tan-quot99.0%
pow299.0%
Applied egg-rr99.0%
Final simplification77.3%
(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.2%
Taylor expanded in x around 0 56.4%
tan-quot56.4%
expm1-log1p-u50.6%
expm1-udef26.2%
Applied egg-rr26.2%
expm1-def50.6%
expm1-log1p56.4%
Simplified56.4%
Final simplification56.4%
(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.2%
Taylor expanded in x around 0 56.4%
Taylor expanded in eps around 0 29.1%
Final simplification29.1%
(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 2023334
(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)))