
(FPCore (x eps) :precision binary64 (- (cos (+ x eps)) (cos x)))
double code(double x, double eps) {
return cos((x + eps)) - cos(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = cos((x + eps)) - cos(x)
end function
public static double code(double x, double eps) {
return Math.cos((x + eps)) - Math.cos(x);
}
def code(x, eps): return math.cos((x + eps)) - math.cos(x)
function code(x, eps) return Float64(cos(Float64(x + eps)) - cos(x)) end
function tmp = code(x, eps) tmp = cos((x + eps)) - cos(x); end
code[x_, eps_] := N[(N[Cos[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(x + \varepsilon\right) - \cos x
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x eps) :precision binary64 (- (cos (+ x eps)) (cos x)))
double code(double x, double eps) {
return cos((x + eps)) - cos(x);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = cos((x + eps)) - cos(x)
end function
public static double code(double x, double eps) {
return Math.cos((x + eps)) - Math.cos(x);
}
def code(x, eps): return math.cos((x + eps)) - math.cos(x)
function code(x, eps) return Float64(cos(Float64(x + eps)) - cos(x)) end
function tmp = code(x, eps) tmp = cos((x + eps)) - cos(x); end
code[x_, eps_] := N[(N[Cos[N[(x + eps), $MachinePrecision]], $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(x + \varepsilon\right) - \cos x
\end{array}
(FPCore (x eps)
:precision binary64
(if (<= eps -8.5e-5)
(- (fma (cos x) (cos eps) (* (- (sin x)) (sin eps))) (cos x))
(if (<= eps 45.0)
(* (sin (* 0.5 (fma 2.0 x eps))) (* -2.0 (sin (* eps 0.5))))
(- (* (cos x) (cos eps)) (fma (sin eps) (sin x) (cos x))))))
double code(double x, double eps) {
double tmp;
if (eps <= -8.5e-5) {
tmp = fma(cos(x), cos(eps), (-sin(x) * sin(eps))) - cos(x);
} else if (eps <= 45.0) {
tmp = sin((0.5 * fma(2.0, x, eps))) * (-2.0 * sin((eps * 0.5)));
} else {
tmp = (cos(x) * cos(eps)) - fma(sin(eps), sin(x), cos(x));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if (eps <= -8.5e-5) tmp = Float64(fma(cos(x), cos(eps), Float64(Float64(-sin(x)) * sin(eps))) - cos(x)); elseif (eps <= 45.0) tmp = Float64(sin(Float64(0.5 * fma(2.0, x, eps))) * Float64(-2.0 * sin(Float64(eps * 0.5)))); else tmp = Float64(Float64(cos(x) * cos(eps)) - fma(sin(eps), sin(x), cos(x))); end return tmp end
code[x_, eps_] := If[LessEqual[eps, -8.5e-5], N[(N[(N[Cos[x], $MachinePrecision] * N[Cos[eps], $MachinePrecision] + N[((-N[Sin[x], $MachinePrecision]) * N[Sin[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 45.0], N[(N[Sin[N[(0.5 * N[(2.0 * x + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[x], $MachinePrecision] * N[Cos[eps], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision] + N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -8.5 \cdot 10^{-5}:\\
\;\;\;\;\mathsf{fma}\left(\cos x, \cos \varepsilon, \left(-\sin x\right) \cdot \sin \varepsilon\right) - \cos x\\
\mathbf{elif}\;\varepsilon \leq 45:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{fma}\left(2, x, \varepsilon\right)\right) \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot \cos \varepsilon - \mathsf{fma}\left(\sin \varepsilon, \sin x, \cos x\right)\\
\end{array}
\end{array}
if eps < -8.500000000000001e-5Initial program 53.8%
cos-sum99.2%
cancel-sign-sub-inv99.2%
fma-def99.2%
Applied egg-rr99.2%
if -8.500000000000001e-5 < eps < 45Initial program 26.7%
diff-cos44.3%
div-inv44.3%
associate--l+44.3%
metadata-eval44.3%
div-inv44.3%
+-commutative44.3%
associate-+l+44.3%
metadata-eval44.3%
Applied egg-rr44.3%
associate-*r*44.3%
*-commutative44.3%
*-commutative44.3%
+-commutative44.3%
count-244.3%
fma-def44.3%
sub-neg44.3%
mul-1-neg44.3%
+-commutative44.3%
associate-+r+99.8%
mul-1-neg99.8%
sub-neg99.8%
+-inverses99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.8%
neg-sub099.8%
mul-1-neg99.8%
remove-double-neg99.8%
Simplified99.8%
if 45 < eps Initial program 48.4%
sub-neg48.4%
cos-sum99.0%
associate-+l-99.1%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.1%
*-commutative99.1%
*-commutative99.1%
fma-neg99.2%
remove-double-neg99.2%
Simplified99.2%
Final simplification99.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (cos x) (cos eps))))
(if (<= eps -1.35e-5)
(- (- t_0 (* (sin x) (sin eps))) (cos x))
(if (<= eps 45.0)
(* (sin (* 0.5 (fma 2.0 x eps))) (* -2.0 (sin (* eps 0.5))))
(- t_0 (fma (sin eps) (sin x) (cos x)))))))
double code(double x, double eps) {
double t_0 = cos(x) * cos(eps);
double tmp;
if (eps <= -1.35e-5) {
tmp = (t_0 - (sin(x) * sin(eps))) - cos(x);
} else if (eps <= 45.0) {
tmp = sin((0.5 * fma(2.0, x, eps))) * (-2.0 * sin((eps * 0.5)));
} else {
tmp = t_0 - fma(sin(eps), sin(x), cos(x));
}
return tmp;
}
function code(x, eps) t_0 = Float64(cos(x) * cos(eps)) tmp = 0.0 if (eps <= -1.35e-5) tmp = Float64(Float64(t_0 - Float64(sin(x) * sin(eps))) - cos(x)); elseif (eps <= 45.0) tmp = Float64(sin(Float64(0.5 * fma(2.0, x, eps))) * Float64(-2.0 * sin(Float64(eps * 0.5)))); else tmp = Float64(t_0 - fma(sin(eps), sin(x), cos(x))); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -1.35e-5], N[(N[(t$95$0 - N[(N[Sin[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 45.0], N[(N[Sin[N[(0.5 * N[(2.0 * x + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[Sin[eps], $MachinePrecision] * N[Sin[x], $MachinePrecision] + N[Cos[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos x \cdot \cos \varepsilon\\
\mathbf{if}\;\varepsilon \leq -1.35 \cdot 10^{-5}:\\
\;\;\;\;\left(t_0 - \sin x \cdot \sin \varepsilon\right) - \cos x\\
\mathbf{elif}\;\varepsilon \leq 45:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{fma}\left(2, x, \varepsilon\right)\right) \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - \mathsf{fma}\left(\sin \varepsilon, \sin x, \cos x\right)\\
\end{array}
\end{array}
if eps < -1.3499999999999999e-5Initial program 53.8%
cos-sum99.2%
Applied egg-rr99.2%
if -1.3499999999999999e-5 < eps < 45Initial program 26.7%
diff-cos44.3%
div-inv44.3%
associate--l+44.3%
metadata-eval44.3%
div-inv44.3%
+-commutative44.3%
associate-+l+44.3%
metadata-eval44.3%
Applied egg-rr44.3%
associate-*r*44.3%
*-commutative44.3%
*-commutative44.3%
+-commutative44.3%
count-244.3%
fma-def44.3%
sub-neg44.3%
mul-1-neg44.3%
+-commutative44.3%
associate-+r+99.8%
mul-1-neg99.8%
sub-neg99.8%
+-inverses99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.8%
neg-sub099.8%
mul-1-neg99.8%
remove-double-neg99.8%
Simplified99.8%
if 45 < eps Initial program 48.4%
sub-neg48.4%
cos-sum99.0%
associate-+l-99.1%
fma-neg99.1%
Applied egg-rr99.1%
fma-neg99.1%
*-commutative99.1%
*-commutative99.1%
fma-neg99.2%
remove-double-neg99.2%
Simplified99.2%
Final simplification99.4%
(FPCore (x eps) :precision binary64 (if (or (<= eps -2.5e-5) (not (<= eps 45.0))) (- (* (cos x) (cos eps)) (+ (cos x) (* (sin x) (sin eps)))) (* (sin (* 0.5 (fma 2.0 x eps))) (* -2.0 (sin (* eps 0.5))))))
double code(double x, double eps) {
double tmp;
if ((eps <= -2.5e-5) || !(eps <= 45.0)) {
tmp = (cos(x) * cos(eps)) - (cos(x) + (sin(x) * sin(eps)));
} else {
tmp = sin((0.5 * fma(2.0, x, eps))) * (-2.0 * sin((eps * 0.5)));
}
return tmp;
}
function code(x, eps) tmp = 0.0 if ((eps <= -2.5e-5) || !(eps <= 45.0)) tmp = Float64(Float64(cos(x) * cos(eps)) - Float64(cos(x) + Float64(sin(x) * sin(eps)))); else tmp = Float64(sin(Float64(0.5 * fma(2.0, x, eps))) * Float64(-2.0 * sin(Float64(eps * 0.5)))); end return tmp end
code[x_, eps_] := If[Or[LessEqual[eps, -2.5e-5], N[Not[LessEqual[eps, 45.0]], $MachinePrecision]], N[(N[(N[Cos[x], $MachinePrecision] * N[Cos[eps], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[x], $MachinePrecision] + N[(N[Sin[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sin[N[(0.5 * N[(2.0 * x + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -2.5 \cdot 10^{-5} \lor \neg \left(\varepsilon \leq 45\right):\\
\;\;\;\;\cos x \cdot \cos \varepsilon - \left(\cos x + \sin x \cdot \sin \varepsilon\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{fma}\left(2, x, \varepsilon\right)\right) \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\end{array}
\end{array}
if eps < -2.50000000000000012e-5 or 45 < eps Initial program 51.5%
sub-neg51.5%
cos-sum99.1%
associate-+l-99.1%
fma-neg99.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 99.1%
if -2.50000000000000012e-5 < eps < 45Initial program 26.7%
diff-cos44.3%
div-inv44.3%
associate--l+44.3%
metadata-eval44.3%
div-inv44.3%
+-commutative44.3%
associate-+l+44.3%
metadata-eval44.3%
Applied egg-rr44.3%
associate-*r*44.3%
*-commutative44.3%
*-commutative44.3%
+-commutative44.3%
count-244.3%
fma-def44.3%
sub-neg44.3%
mul-1-neg44.3%
+-commutative44.3%
associate-+r+99.8%
mul-1-neg99.8%
sub-neg99.8%
+-inverses99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.8%
neg-sub099.8%
mul-1-neg99.8%
remove-double-neg99.8%
Simplified99.8%
Final simplification99.4%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (* (cos x) (cos eps))) (t_1 (* (sin x) (sin eps))))
(if (<= eps -0.00048)
(- (- t_0 t_1) (cos x))
(if (<= eps 45.0)
(* (sin (* 0.5 (fma 2.0 x eps))) (* -2.0 (sin (* eps 0.5))))
(- t_0 (+ (cos x) t_1))))))
double code(double x, double eps) {
double t_0 = cos(x) * cos(eps);
double t_1 = sin(x) * sin(eps);
double tmp;
if (eps <= -0.00048) {
tmp = (t_0 - t_1) - cos(x);
} else if (eps <= 45.0) {
tmp = sin((0.5 * fma(2.0, x, eps))) * (-2.0 * sin((eps * 0.5)));
} else {
tmp = t_0 - (cos(x) + t_1);
}
return tmp;
}
function code(x, eps) t_0 = Float64(cos(x) * cos(eps)) t_1 = Float64(sin(x) * sin(eps)) tmp = 0.0 if (eps <= -0.00048) tmp = Float64(Float64(t_0 - t_1) - cos(x)); elseif (eps <= 45.0) tmp = Float64(sin(Float64(0.5 * fma(2.0, x, eps))) * Float64(-2.0 * sin(Float64(eps * 0.5)))); else tmp = Float64(t_0 - Float64(cos(x) + t_1)); end return tmp end
code[x_, eps_] := Block[{t$95$0 = N[(N[Cos[x], $MachinePrecision] * N[Cos[eps], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[x], $MachinePrecision] * N[Sin[eps], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[eps, -0.00048], N[(N[(t$95$0 - t$95$1), $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision], If[LessEqual[eps, 45.0], N[(N[Sin[N[(0.5 * N[(2.0 * x + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 - N[(N[Cos[x], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos x \cdot \cos \varepsilon\\
t_1 := \sin x \cdot \sin \varepsilon\\
\mathbf{if}\;\varepsilon \leq -0.00048:\\
\;\;\;\;\left(t_0 - t_1\right) - \cos x\\
\mathbf{elif}\;\varepsilon \leq 45:\\
\;\;\;\;\sin \left(0.5 \cdot \mathsf{fma}\left(2, x, \varepsilon\right)\right) \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_0 - \left(\cos x + t_1\right)\\
\end{array}
\end{array}
if eps < -4.80000000000000012e-4Initial program 53.8%
cos-sum99.2%
Applied egg-rr99.2%
if -4.80000000000000012e-4 < eps < 45Initial program 26.7%
diff-cos44.3%
div-inv44.3%
associate--l+44.3%
metadata-eval44.3%
div-inv44.3%
+-commutative44.3%
associate-+l+44.3%
metadata-eval44.3%
Applied egg-rr44.3%
associate-*r*44.3%
*-commutative44.3%
*-commutative44.3%
+-commutative44.3%
count-244.3%
fma-def44.3%
sub-neg44.3%
mul-1-neg44.3%
+-commutative44.3%
associate-+r+99.8%
mul-1-neg99.8%
sub-neg99.8%
+-inverses99.8%
remove-double-neg99.8%
mul-1-neg99.8%
sub-neg99.8%
neg-sub099.8%
mul-1-neg99.8%
remove-double-neg99.8%
Simplified99.8%
if 45 < eps Initial program 48.4%
sub-neg48.4%
cos-sum99.0%
associate-+l-99.1%
fma-neg99.1%
Applied egg-rr99.1%
Taylor expanded in x around inf 99.1%
Final simplification99.4%
(FPCore (x eps) :precision binary64 (if (or (<= eps -0.0075) (not (<= eps 0.00032))) (- (cos eps) (cos x)) (- (* (cos x) (* -0.5 (pow eps 2.0))) (* eps (sin x)))))
double code(double x, double eps) {
double tmp;
if ((eps <= -0.0075) || !(eps <= 0.00032)) {
tmp = cos(eps) - cos(x);
} else {
tmp = (cos(x) * (-0.5 * pow(eps, 2.0))) - (eps * sin(x));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-0.0075d0)) .or. (.not. (eps <= 0.00032d0))) then
tmp = cos(eps) - cos(x)
else
tmp = (cos(x) * ((-0.5d0) * (eps ** 2.0d0))) - (eps * sin(x))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -0.0075) || !(eps <= 0.00032)) {
tmp = Math.cos(eps) - Math.cos(x);
} else {
tmp = (Math.cos(x) * (-0.5 * Math.pow(eps, 2.0))) - (eps * Math.sin(x));
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -0.0075) or not (eps <= 0.00032): tmp = math.cos(eps) - math.cos(x) else: tmp = (math.cos(x) * (-0.5 * math.pow(eps, 2.0))) - (eps * math.sin(x)) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -0.0075) || !(eps <= 0.00032)) tmp = Float64(cos(eps) - cos(x)); else tmp = Float64(Float64(cos(x) * Float64(-0.5 * (eps ^ 2.0))) - Float64(eps * sin(x))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -0.0075) || ~((eps <= 0.00032))) tmp = cos(eps) - cos(x); else tmp = (cos(x) * (-0.5 * (eps ^ 2.0))) - (eps * sin(x)); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -0.0075], N[Not[LessEqual[eps, 0.00032]], $MachinePrecision]], N[(N[Cos[eps], $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision], N[(N[(N[Cos[x], $MachinePrecision] * N[(-0.5 * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(eps * N[Sin[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.0075 \lor \neg \left(\varepsilon \leq 0.00032\right):\\
\;\;\;\;\cos \varepsilon - \cos x\\
\mathbf{else}:\\
\;\;\;\;\cos x \cdot \left(-0.5 \cdot {\varepsilon}^{2}\right) - \varepsilon \cdot \sin x\\
\end{array}
\end{array}
if eps < -0.0074999999999999997 or 3.20000000000000026e-4 < eps Initial program 52.3%
Taylor expanded in x around 0 55.6%
if -0.0074999999999999997 < eps < 3.20000000000000026e-4Initial program 25.1%
Taylor expanded in eps around 0 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification75.3%
(FPCore (x eps) :precision binary64 (* (sin (* 0.5 (fma 2.0 x eps))) (* -2.0 (sin (* eps 0.5)))))
double code(double x, double eps) {
return sin((0.5 * fma(2.0, x, eps))) * (-2.0 * sin((eps * 0.5)));
}
function code(x, eps) return Float64(sin(Float64(0.5 * fma(2.0, x, eps))) * Float64(-2.0 * sin(Float64(eps * 0.5)))) end
code[x_, eps_] := N[(N[Sin[N[(0.5 * N[(2.0 * x + eps), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\sin \left(0.5 \cdot \mathsf{fma}\left(2, x, \varepsilon\right)\right) \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)
\end{array}
Initial program 40.2%
diff-cos47.8%
div-inv47.8%
associate--l+47.8%
metadata-eval47.8%
div-inv47.8%
+-commutative47.8%
associate-+l+47.9%
metadata-eval47.9%
Applied egg-rr47.9%
associate-*r*47.9%
*-commutative47.9%
*-commutative47.9%
+-commutative47.9%
count-247.9%
fma-def47.9%
sub-neg47.9%
mul-1-neg47.9%
+-commutative47.9%
associate-+r+74.5%
mul-1-neg74.5%
sub-neg74.5%
+-inverses74.5%
remove-double-neg74.5%
mul-1-neg74.5%
sub-neg74.5%
neg-sub074.5%
mul-1-neg74.5%
remove-double-neg74.5%
Simplified74.5%
Final simplification74.5%
(FPCore (x eps) :precision binary64 (if (or (<= x -1.55e-18) (not (<= x 1.1e-27))) (* (sin x) (* -2.0 (sin (* eps 0.5)))) (* (* -2.0 (sin (* 0.5 (+ x (- eps x))))) (sin (* 0.5 (+ eps (+ x x)))))))
double code(double x, double eps) {
double tmp;
if ((x <= -1.55e-18) || !(x <= 1.1e-27)) {
tmp = sin(x) * (-2.0 * sin((eps * 0.5)));
} else {
tmp = (-2.0 * sin((0.5 * (x + (eps - x))))) * sin((0.5 * (eps + (x + x))));
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((x <= (-1.55d-18)) .or. (.not. (x <= 1.1d-27))) then
tmp = sin(x) * ((-2.0d0) * sin((eps * 0.5d0)))
else
tmp = ((-2.0d0) * sin((0.5d0 * (x + (eps - x))))) * sin((0.5d0 * (eps + (x + x))))
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((x <= -1.55e-18) || !(x <= 1.1e-27)) {
tmp = Math.sin(x) * (-2.0 * Math.sin((eps * 0.5)));
} else {
tmp = (-2.0 * Math.sin((0.5 * (x + (eps - x))))) * Math.sin((0.5 * (eps + (x + x))));
}
return tmp;
}
def code(x, eps): tmp = 0 if (x <= -1.55e-18) or not (x <= 1.1e-27): tmp = math.sin(x) * (-2.0 * math.sin((eps * 0.5))) else: tmp = (-2.0 * math.sin((0.5 * (x + (eps - x))))) * math.sin((0.5 * (eps + (x + x)))) return tmp
function code(x, eps) tmp = 0.0 if ((x <= -1.55e-18) || !(x <= 1.1e-27)) tmp = Float64(sin(x) * Float64(-2.0 * sin(Float64(eps * 0.5)))); else tmp = Float64(Float64(-2.0 * sin(Float64(0.5 * Float64(x + Float64(eps - x))))) * sin(Float64(0.5 * Float64(eps + Float64(x + x))))); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((x <= -1.55e-18) || ~((x <= 1.1e-27))) tmp = sin(x) * (-2.0 * sin((eps * 0.5))); else tmp = (-2.0 * sin((0.5 * (x + (eps - x))))) * sin((0.5 * (eps + (x + x)))); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[x, -1.55e-18], N[Not[LessEqual[x, 1.1e-27]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(-2.0 * N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-2.0 * N[Sin[N[(0.5 * N[(x + N[(eps - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.5 * N[(eps + N[(x + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{-18} \lor \neg \left(x \leq 1.1 \cdot 10^{-27}\right):\\
\;\;\;\;\sin x \cdot \left(-2 \cdot \sin \left(\varepsilon \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(-2 \cdot \sin \left(0.5 \cdot \left(x + \left(\varepsilon - x\right)\right)\right)\right) \cdot \sin \left(0.5 \cdot \left(\varepsilon + \left(x + x\right)\right)\right)\\
\end{array}
\end{array}
if x < -1.55000000000000003e-18 or 1.09999999999999993e-27 < x Initial program 7.1%
diff-cos6.5%
div-inv6.5%
associate--l+6.5%
metadata-eval6.5%
div-inv6.5%
+-commutative6.5%
associate-+l+6.6%
metadata-eval6.6%
Applied egg-rr6.6%
associate-*r*6.6%
*-commutative6.6%
*-commutative6.6%
+-commutative6.6%
count-26.6%
fma-def6.6%
sub-neg6.6%
mul-1-neg6.6%
+-commutative6.6%
associate-+r+50.7%
mul-1-neg50.7%
sub-neg50.7%
+-inverses50.7%
remove-double-neg50.7%
mul-1-neg50.7%
sub-neg50.7%
neg-sub050.7%
mul-1-neg50.7%
remove-double-neg50.7%
Simplified50.7%
Taylor expanded in eps around 0 50.7%
if -1.55000000000000003e-18 < x < 1.09999999999999993e-27Initial program 74.8%
diff-cos91.2%
associate-*r*91.2%
div-inv91.2%
associate--l+91.2%
metadata-eval91.2%
div-inv91.2%
+-commutative91.2%
associate-+l+91.2%
metadata-eval91.2%
Applied egg-rr91.2%
Final simplification70.5%
(FPCore (x eps)
:precision binary64
(let* ((t_0 (sin (* eps 0.5))))
(if (or (<= x -2e-21) (not (<= x 2.4e-32)))
(* (sin x) (* -2.0 t_0))
(* -2.0 (pow t_0 2.0)))))
double code(double x, double eps) {
double t_0 = sin((eps * 0.5));
double tmp;
if ((x <= -2e-21) || !(x <= 2.4e-32)) {
tmp = sin(x) * (-2.0 * t_0);
} else {
tmp = -2.0 * pow(t_0, 2.0);
}
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 = sin((eps * 0.5d0))
if ((x <= (-2d-21)) .or. (.not. (x <= 2.4d-32))) then
tmp = sin(x) * ((-2.0d0) * t_0)
else
tmp = (-2.0d0) * (t_0 ** 2.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double t_0 = Math.sin((eps * 0.5));
double tmp;
if ((x <= -2e-21) || !(x <= 2.4e-32)) {
tmp = Math.sin(x) * (-2.0 * t_0);
} else {
tmp = -2.0 * Math.pow(t_0, 2.0);
}
return tmp;
}
def code(x, eps): t_0 = math.sin((eps * 0.5)) tmp = 0 if (x <= -2e-21) or not (x <= 2.4e-32): tmp = math.sin(x) * (-2.0 * t_0) else: tmp = -2.0 * math.pow(t_0, 2.0) return tmp
function code(x, eps) t_0 = sin(Float64(eps * 0.5)) tmp = 0.0 if ((x <= -2e-21) || !(x <= 2.4e-32)) tmp = Float64(sin(x) * Float64(-2.0 * t_0)); else tmp = Float64(-2.0 * (t_0 ^ 2.0)); end return tmp end
function tmp_2 = code(x, eps) t_0 = sin((eps * 0.5)); tmp = 0.0; if ((x <= -2e-21) || ~((x <= 2.4e-32))) tmp = sin(x) * (-2.0 * t_0); else tmp = -2.0 * (t_0 ^ 2.0); end tmp_2 = tmp; end
code[x_, eps_] := Block[{t$95$0 = N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[x, -2e-21], N[Not[LessEqual[x, 2.4e-32]], $MachinePrecision]], N[(N[Sin[x], $MachinePrecision] * N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin \left(\varepsilon \cdot 0.5\right)\\
\mathbf{if}\;x \leq -2 \cdot 10^{-21} \lor \neg \left(x \leq 2.4 \cdot 10^{-32}\right):\\
\;\;\;\;\sin x \cdot \left(-2 \cdot t_0\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot {t_0}^{2}\\
\end{array}
\end{array}
if x < -1.99999999999999982e-21 or 2.4000000000000001e-32 < x Initial program 7.1%
diff-cos6.5%
div-inv6.5%
associate--l+6.5%
metadata-eval6.5%
div-inv6.5%
+-commutative6.5%
associate-+l+6.6%
metadata-eval6.6%
Applied egg-rr6.6%
associate-*r*6.6%
*-commutative6.6%
*-commutative6.6%
+-commutative6.6%
count-26.6%
fma-def6.6%
sub-neg6.6%
mul-1-neg6.6%
+-commutative6.6%
associate-+r+50.7%
mul-1-neg50.7%
sub-neg50.7%
+-inverses50.7%
remove-double-neg50.7%
mul-1-neg50.7%
sub-neg50.7%
neg-sub050.7%
mul-1-neg50.7%
remove-double-neg50.7%
Simplified50.7%
Taylor expanded in eps around 0 50.7%
if -1.99999999999999982e-21 < x < 2.4000000000000001e-32Initial program 74.8%
diff-cos91.2%
div-inv91.2%
associate--l+91.2%
metadata-eval91.2%
div-inv91.2%
+-commutative91.2%
associate-+l+91.2%
metadata-eval91.2%
Applied egg-rr91.2%
associate-*r*91.2%
*-commutative91.2%
*-commutative91.2%
+-commutative91.2%
count-291.2%
fma-def91.2%
sub-neg91.2%
mul-1-neg91.2%
+-commutative91.2%
associate-+r+99.5%
mul-1-neg99.5%
sub-neg99.5%
+-inverses99.5%
remove-double-neg99.5%
mul-1-neg99.5%
sub-neg99.5%
neg-sub099.5%
mul-1-neg99.5%
remove-double-neg99.5%
Simplified99.5%
Taylor expanded in x around 0 88.9%
Final simplification69.3%
(FPCore (x eps) :precision binary64 (if (or (<= eps -5.1e-24) (not (<= eps 1.55e-69))) (* -2.0 (pow (sin (* eps 0.5)) 2.0)) (* (sin x) (- eps))))
double code(double x, double eps) {
double tmp;
if ((eps <= -5.1e-24) || !(eps <= 1.55e-69)) {
tmp = -2.0 * pow(sin((eps * 0.5)), 2.0);
} else {
tmp = sin(x) * -eps;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-5.1d-24)) .or. (.not. (eps <= 1.55d-69))) then
tmp = (-2.0d0) * (sin((eps * 0.5d0)) ** 2.0d0)
else
tmp = sin(x) * -eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -5.1e-24) || !(eps <= 1.55e-69)) {
tmp = -2.0 * Math.pow(Math.sin((eps * 0.5)), 2.0);
} else {
tmp = Math.sin(x) * -eps;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -5.1e-24) or not (eps <= 1.55e-69): tmp = -2.0 * math.pow(math.sin((eps * 0.5)), 2.0) else: tmp = math.sin(x) * -eps return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -5.1e-24) || !(eps <= 1.55e-69)) tmp = Float64(-2.0 * (sin(Float64(eps * 0.5)) ^ 2.0)); else tmp = Float64(sin(x) * Float64(-eps)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -5.1e-24) || ~((eps <= 1.55e-69))) tmp = -2.0 * (sin((eps * 0.5)) ^ 2.0); else tmp = sin(x) * -eps; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -5.1e-24], N[Not[LessEqual[eps, 1.55e-69]], $MachinePrecision]], N[(-2.0 * N[Power[N[Sin[N[(eps * 0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * (-eps)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -5.1 \cdot 10^{-24} \lor \neg \left(\varepsilon \leq 1.55 \cdot 10^{-69}\right):\\
\;\;\;\;-2 \cdot {\sin \left(\varepsilon \cdot 0.5\right)}^{2}\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \left(-\varepsilon\right)\\
\end{array}
\end{array}
if eps < -5.10000000000000025e-24 or 1.55e-69 < eps Initial program 49.1%
diff-cos53.7%
div-inv53.7%
associate--l+53.7%
metadata-eval53.7%
div-inv53.7%
+-commutative53.7%
associate-+l+53.8%
metadata-eval53.8%
Applied egg-rr53.8%
associate-*r*53.8%
*-commutative53.8%
*-commutative53.8%
+-commutative53.8%
count-253.8%
fma-def53.8%
sub-neg53.8%
mul-1-neg53.8%
+-commutative53.8%
associate-+r+57.2%
mul-1-neg57.2%
sub-neg57.2%
+-inverses57.2%
remove-double-neg57.2%
mul-1-neg57.2%
sub-neg57.2%
neg-sub057.2%
mul-1-neg57.2%
remove-double-neg57.2%
Simplified57.2%
Taylor expanded in x around 0 55.3%
if -5.10000000000000025e-24 < eps < 1.55e-69Initial program 27.2%
Taylor expanded in eps around 0 88.5%
mul-1-neg88.5%
*-commutative88.5%
distribute-rgt-neg-in88.5%
Simplified88.5%
Final simplification68.8%
(FPCore (x eps) :precision binary64 (if (or (<= eps -8e-6) (not (<= eps 2.2e-33))) (- (cos eps) (cos x)) (* (sin x) (- eps))))
double code(double x, double eps) {
double tmp;
if ((eps <= -8e-6) || !(eps <= 2.2e-33)) {
tmp = cos(eps) - cos(x);
} else {
tmp = sin(x) * -eps;
}
return tmp;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
real(8) :: tmp
if ((eps <= (-8d-6)) .or. (.not. (eps <= 2.2d-33))) then
tmp = cos(eps) - cos(x)
else
tmp = sin(x) * -eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -8e-6) || !(eps <= 2.2e-33)) {
tmp = Math.cos(eps) - Math.cos(x);
} else {
tmp = Math.sin(x) * -eps;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -8e-6) or not (eps <= 2.2e-33): tmp = math.cos(eps) - math.cos(x) else: tmp = math.sin(x) * -eps return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -8e-6) || !(eps <= 2.2e-33)) tmp = Float64(cos(eps) - cos(x)); else tmp = Float64(sin(x) * Float64(-eps)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -8e-6) || ~((eps <= 2.2e-33))) tmp = cos(eps) - cos(x); else tmp = sin(x) * -eps; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -8e-6], N[Not[LessEqual[eps, 2.2e-33]], $MachinePrecision]], N[(N[Cos[eps], $MachinePrecision] - N[Cos[x], $MachinePrecision]), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * (-eps)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -8 \cdot 10^{-6} \lor \neg \left(\varepsilon \leq 2.2 \cdot 10^{-33}\right):\\
\;\;\;\;\cos \varepsilon - \cos x\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \left(-\varepsilon\right)\\
\end{array}
\end{array}
if eps < -7.99999999999999964e-6 or 2.20000000000000005e-33 < eps Initial program 51.9%
Taylor expanded in x around 0 55.3%
if -7.99999999999999964e-6 < eps < 2.20000000000000005e-33Initial program 25.3%
Taylor expanded in eps around 0 83.5%
mul-1-neg83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
Simplified83.5%
Final simplification67.7%
(FPCore (x eps) :precision binary64 (if (or (<= eps -0.000115) (not (<= eps 0.00013))) (+ (cos eps) -1.0) (* -0.5 (pow eps 2.0))))
double code(double x, double eps) {
double tmp;
if ((eps <= -0.000115) || !(eps <= 0.00013)) {
tmp = cos(eps) + -1.0;
} else {
tmp = -0.5 * pow(eps, 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 <= (-0.000115d0)) .or. (.not. (eps <= 0.00013d0))) then
tmp = cos(eps) + (-1.0d0)
else
tmp = (-0.5d0) * (eps ** 2.0d0)
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -0.000115) || !(eps <= 0.00013)) {
tmp = Math.cos(eps) + -1.0;
} else {
tmp = -0.5 * Math.pow(eps, 2.0);
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -0.000115) or not (eps <= 0.00013): tmp = math.cos(eps) + -1.0 else: tmp = -0.5 * math.pow(eps, 2.0) return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -0.000115) || !(eps <= 0.00013)) tmp = Float64(cos(eps) + -1.0); else tmp = Float64(-0.5 * (eps ^ 2.0)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -0.000115) || ~((eps <= 0.00013))) tmp = cos(eps) + -1.0; else tmp = -0.5 * (eps ^ 2.0); end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -0.000115], N[Not[LessEqual[eps, 0.00013]], $MachinePrecision]], N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision], N[(-0.5 * N[Power[eps, 2.0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.000115 \lor \neg \left(\varepsilon \leq 0.00013\right):\\
\;\;\;\;\cos \varepsilon + -1\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot {\varepsilon}^{2}\\
\end{array}
\end{array}
if eps < -1.15e-4 or 1.29999999999999989e-4 < eps Initial program 52.3%
Taylor expanded in x around 0 53.4%
if -1.15e-4 < eps < 1.29999999999999989e-4Initial program 25.1%
Taylor expanded in x around 0 25.1%
Taylor expanded in eps around 0 40.5%
Final simplification47.7%
(FPCore (x eps) :precision binary64 (if (or (<= eps -0.00048) (not (<= eps 2.2e-33))) (+ (cos eps) -1.0) (* (sin x) (- eps))))
double code(double x, double eps) {
double tmp;
if ((eps <= -0.00048) || !(eps <= 2.2e-33)) {
tmp = cos(eps) + -1.0;
} else {
tmp = sin(x) * -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.00048d0)) .or. (.not. (eps <= 2.2d-33))) then
tmp = cos(eps) + (-1.0d0)
else
tmp = sin(x) * -eps
end if
code = tmp
end function
public static double code(double x, double eps) {
double tmp;
if ((eps <= -0.00048) || !(eps <= 2.2e-33)) {
tmp = Math.cos(eps) + -1.0;
} else {
tmp = Math.sin(x) * -eps;
}
return tmp;
}
def code(x, eps): tmp = 0 if (eps <= -0.00048) or not (eps <= 2.2e-33): tmp = math.cos(eps) + -1.0 else: tmp = math.sin(x) * -eps return tmp
function code(x, eps) tmp = 0.0 if ((eps <= -0.00048) || !(eps <= 2.2e-33)) tmp = Float64(cos(eps) + -1.0); else tmp = Float64(sin(x) * Float64(-eps)); end return tmp end
function tmp_2 = code(x, eps) tmp = 0.0; if ((eps <= -0.00048) || ~((eps <= 2.2e-33))) tmp = cos(eps) + -1.0; else tmp = sin(x) * -eps; end tmp_2 = tmp; end
code[x_, eps_] := If[Or[LessEqual[eps, -0.00048], N[Not[LessEqual[eps, 2.2e-33]], $MachinePrecision]], N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision], N[(N[Sin[x], $MachinePrecision] * (-eps)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\varepsilon \leq -0.00048 \lor \neg \left(\varepsilon \leq 2.2 \cdot 10^{-33}\right):\\
\;\;\;\;\cos \varepsilon + -1\\
\mathbf{else}:\\
\;\;\;\;\sin x \cdot \left(-\varepsilon\right)\\
\end{array}
\end{array}
if eps < -4.80000000000000012e-4 or 2.20000000000000005e-33 < eps Initial program 51.9%
Taylor expanded in x around 0 53.1%
if -4.80000000000000012e-4 < eps < 2.20000000000000005e-33Initial program 25.3%
Taylor expanded in eps around 0 83.5%
mul-1-neg83.5%
*-commutative83.5%
distribute-rgt-neg-in83.5%
Simplified83.5%
Final simplification66.5%
(FPCore (x eps) :precision binary64 (+ (cos eps) -1.0))
double code(double x, double eps) {
return cos(eps) + -1.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = cos(eps) + (-1.0d0)
end function
public static double code(double x, double eps) {
return Math.cos(eps) + -1.0;
}
def code(x, eps): return math.cos(eps) + -1.0
function code(x, eps) return Float64(cos(eps) + -1.0) end
function tmp = code(x, eps) tmp = cos(eps) + -1.0; end
code[x_, eps_] := N[(N[Cos[eps], $MachinePrecision] + -1.0), $MachinePrecision]
\begin{array}{l}
\\
\cos \varepsilon + -1
\end{array}
Initial program 40.2%
Taylor expanded in x around 0 40.8%
Final simplification40.8%
(FPCore (x eps) :precision binary64 (pow eps 2.0))
double code(double x, double eps) {
return pow(eps, 2.0);
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = eps ** 2.0d0
end function
public static double code(double x, double eps) {
return Math.pow(eps, 2.0);
}
def code(x, eps): return math.pow(eps, 2.0)
function code(x, eps) return eps ^ 2.0 end
function tmp = code(x, eps) tmp = eps ^ 2.0; end
code[x_, eps_] := N[Power[eps, 2.0], $MachinePrecision]
\begin{array}{l}
\\
{\varepsilon}^{2}
\end{array}
Initial program 40.2%
diff-cos47.8%
div-inv47.8%
associate--l+47.8%
metadata-eval47.8%
div-inv47.8%
+-commutative47.8%
associate-+l+47.9%
metadata-eval47.9%
Applied egg-rr47.9%
associate-*r*47.9%
*-commutative47.9%
*-commutative47.9%
+-commutative47.9%
count-247.9%
fma-def47.9%
sub-neg47.9%
mul-1-neg47.9%
+-commutative47.9%
associate-+r+74.5%
mul-1-neg74.5%
sub-neg74.5%
+-inverses74.5%
remove-double-neg74.5%
mul-1-neg74.5%
sub-neg74.5%
neg-sub074.5%
mul-1-neg74.5%
remove-double-neg74.5%
Simplified74.5%
expm1-log1p-u74.5%
Applied egg-rr74.5%
Taylor expanded in x around 0 41.3%
Simplified16.4%
Taylor expanded in eps around 0 12.2%
Final simplification12.2%
(FPCore (x eps) :precision binary64 4.0)
double code(double x, double eps) {
return 4.0;
}
real(8) function code(x, eps)
real(8), intent (in) :: x
real(8), intent (in) :: eps
code = 4.0d0
end function
public static double code(double x, double eps) {
return 4.0;
}
def code(x, eps): return 4.0
function code(x, eps) return 4.0 end
function tmp = code(x, eps) tmp = 4.0; end
code[x_, eps_] := 4.0
\begin{array}{l}
\\
4
\end{array}
Initial program 40.2%
add-exp-log25.9%
Applied egg-rr25.9%
rem-exp-log40.2%
*-un-lft-identity40.2%
add-sqr-sqrt26.0%
prod-diff25.9%
*-commutative25.9%
*-un-lft-identity25.9%
fma-def26.0%
add-sqr-sqrt0.7%
sqrt-unprod2.5%
sqr-neg2.5%
sqrt-unprod1.8%
add-sqr-sqrt2.0%
add-sqr-sqrt3.3%
Applied egg-rr3.0%
+-commutative3.0%
associate-+l+3.0%
+-commutative3.0%
fma-udef3.0%
*-rgt-identity3.0%
Simplified3.0%
Taylor expanded in eps around 0 3.0%
Simplified4.6%
Final simplification4.6%
herbie shell --seed 2023300
(FPCore (x eps)
:name "2cos (problem 3.3.5)"
:precision binary64
(- (cos (+ x eps)) (cos x)))