
(FPCore (x y z t a b) :precision binary64 (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))
double code(double x, double y, double z, double t, double a, double b) {
return (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (x * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos((((((a * 2.0d0) + 1.0d0) * b) * t) / 16.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
def code(x, y, z, t, a, b): return (x * math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0))
function code(x, y, z, t, a, b) return Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(Float64(Float64(Float64(a * 2.0) + 1.0) * b) * t) / 16.0))) end
function tmp = code(x, y, z, t, a, b) tmp = (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 6 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))
double code(double x, double y, double z, double t, double a, double b) {
return (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (x * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos((((((a * 2.0d0) + 1.0d0) * b) * t) / 16.0d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0));
}
def code(x, y, z, t, a, b): return (x * math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * math.cos((((((a * 2.0) + 1.0) * b) * t) / 16.0))
function code(x, y, z, t, a, b) return Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(Float64(Float64(Float64(a * 2.0) + 1.0) * b) * t) / 16.0))) end
function tmp = code(x, y, z, t, a, b) tmp = (x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos((((((a * 2.0) + 1.0) * b) * t) / 16.0)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[(N[(N[(a * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0))))
(if (<= (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) t_1) 1e+245)
(* t_1 (* x (cos (/ (pow (cbrt (* (fma y 2.0 1.0) (* z t))) 3.0) 16.0))))
(* x (expm1 (fma -0.0009765625 (pow (* t b) 2.0) (log 2.0)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0));
double tmp;
if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * t_1) <= 1e+245) {
tmp = t_1 * (x * cos((pow(cbrt((fma(y, 2.0, 1.0) * (z * t))), 3.0) / 16.0)));
} else {
tmp = x * expm1(fma(-0.0009765625, pow((t * b), 2.0), log(2.0)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = cos(Float64(Float64(t * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0)) tmp = 0.0 if (Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * t_1) <= 1e+245) tmp = Float64(t_1 * Float64(x * cos(Float64((cbrt(Float64(fma(y, 2.0, 1.0) * Float64(z * t))) ^ 3.0) / 16.0)))); else tmp = Float64(x * expm1(fma(-0.0009765625, (Float64(t * b) ^ 2.0), log(2.0)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[Cos[N[(N[(t * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], 1e+245], N[(t$95$1 * N[(x * N[Cos[N[(N[Power[N[Power[N[(N[(y * 2.0 + 1.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(-0.0009765625 * N[Power[N[(t * b), $MachinePrecision], 2.0], $MachinePrecision] + N[Log[2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\\
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot t_1 \leq 10^{+245}:\\
\;\;\;\;t_1 \cdot \left(x \cdot \cos \left(\frac{{\left(\sqrt[3]{\mathsf{fma}\left(y, 2, 1\right) \cdot \left(z \cdot t\right)}\right)}^{3}}{16}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16))) < 1.00000000000000004e245Initial program 46.2%
add-cube-cbrt47.0%
pow347.1%
associate-*l*47.0%
fma-def47.0%
Applied egg-rr47.0%
if 1.00000000000000004e245 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16))) Initial program 3.3%
associate-*l*3.3%
*-commutative3.3%
*-commutative3.3%
associate-*l/3.3%
fma-def3.3%
associate-*l/3.3%
*-commutative3.3%
fma-def3.3%
Simplified3.3%
Taylor expanded in z around 0 9.3%
Taylor expanded in a around 0 12.1%
expm1-log1p-u12.1%
Applied egg-rr12.1%
Taylor expanded in t around 0 14.4%
+-commutative14.4%
fma-def14.4%
unpow214.4%
unpow214.4%
swap-sqr15.9%
unpow215.9%
Simplified15.9%
Final simplification33.0%
(FPCore (x y z t a b)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
(cos (/ (* t (* (+ 1.0 (* 2.0 a)) b)) 16.0)))
1e+245)
(*
(* x (cos (/ (* z (fma y 2.0 1.0)) (/ 16.0 t))))
(cos (* t (* (* b (+ -1.0 (* a -2.0))) -0.0625))))
(* x (expm1 (+ (log 2.0) (* -0.0009765625 (* (* t t) (* b b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 1e+245) {
tmp = (x * cos(((z * fma(y, 2.0, 1.0)) / (16.0 / t)))) * cos((t * ((b * (-1.0 + (a * -2.0))) * -0.0625)));
} else {
tmp = x * expm1((log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(x * cos(Float64(Float64(Float64(Float64(Float64(y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(Float64(Float64(t * Float64(Float64(1.0 + Float64(2.0 * a)) * b)) / 16.0))) <= 1e+245) tmp = Float64(Float64(x * cos(Float64(Float64(z * fma(y, 2.0, 1.0)) / Float64(16.0 / t)))) * cos(Float64(t * Float64(Float64(b * Float64(-1.0 + Float64(a * -2.0))) * -0.0625)))); else tmp = Float64(x * expm1(Float64(log(2.0) + Float64(-0.0009765625 * Float64(Float64(t * t) * Float64(b * b)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(x * N[Cos[N[(N[(N[(N[(N[(y * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t * N[(N[(1.0 + N[(2.0 * a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e+245], N[(N[(x * N[Cos[N[(N[(z * N[(y * 2.0 + 1.0), $MachinePrecision]), $MachinePrecision] / N[(16.0 / t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(t * N[(N[(b * N[(-1.0 + N[(a * -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[(N[(t * t), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right) \leq 10^{+245}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot \mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right)\right) \cdot \cos \left(t \cdot \left(\left(b \cdot \left(-1 + a \cdot -2\right)\right) \cdot -0.0625\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16))) < 1.00000000000000004e245Initial program 46.2%
*-commutative46.2%
associate-*l*46.2%
cos-neg46.2%
distribute-frac-neg46.2%
distribute-lft-neg-in46.2%
distribute-rgt-neg-out46.2%
associate-*l*46.2%
*-commutative46.2%
Simplified46.8%
fma-def46.8%
associate-/l*46.8%
frac-2neg46.8%
div-inv46.8%
*-commutative46.8%
*-commutative46.8%
fma-udef46.8%
distribute-rgt-neg-in46.8%
fma-udef46.8%
*-commutative46.8%
distribute-rgt-neg-in46.8%
*-commutative46.8%
fma-udef46.8%
metadata-eval46.8%
metadata-eval46.8%
Applied egg-rr46.8%
associate-*l*46.8%
distribute-rgt-neg-out46.8%
*-commutative46.8%
distribute-rgt-neg-in46.8%
neg-sub046.8%
fma-udef46.8%
+-commutative46.8%
metadata-eval46.8%
cancel-sign-sub-inv46.8%
associate--r-46.8%
metadata-eval46.8%
*-commutative46.8%
Simplified46.8%
if 1.00000000000000004e245 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y 2) 1) z) t) 16))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a 2) 1) b) t) 16))) Initial program 3.3%
associate-*l*3.3%
*-commutative3.3%
*-commutative3.3%
associate-*l/3.3%
fma-def3.3%
associate-*l/3.3%
*-commutative3.3%
fma-def3.3%
Simplified3.3%
Taylor expanded in z around 0 9.3%
Taylor expanded in a around 0 12.1%
expm1-log1p-u12.1%
Applied egg-rr12.1%
Taylor expanded in t around 0 14.4%
unpow214.4%
unpow214.4%
Simplified14.4%
Final simplification32.2%
(FPCore (x y z t a b) :precision binary64 (* x (expm1 (fma -0.0009765625 (pow (* t b) 2.0) (log 2.0)))))
double code(double x, double y, double z, double t, double a, double b) {
return x * expm1(fma(-0.0009765625, pow((t * b), 2.0), log(2.0)));
}
function code(x, y, z, t, a, b) return Float64(x * expm1(fma(-0.0009765625, (Float64(t * b) ^ 2.0), log(2.0)))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[(Exp[N[(-0.0009765625 * N[Power[N[(t * b), $MachinePrecision], 2.0], $MachinePrecision] + N[Log[2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \mathsf{expm1}\left(\mathsf{fma}\left(-0.0009765625, {\left(t \cdot b\right)}^{2}, \log 2\right)\right)
\end{array}
Initial program 26.9%
associate-*l*26.9%
*-commutative26.9%
*-commutative26.9%
associate-*l/26.9%
fma-def26.9%
associate-*l/26.9%
*-commutative26.9%
fma-def26.9%
Simplified26.9%
Taylor expanded in z around 0 28.9%
Taylor expanded in a around 0 30.0%
expm1-log1p-u30.0%
Applied egg-rr30.0%
Taylor expanded in t around 0 29.3%
+-commutative29.3%
fma-def29.3%
unpow229.3%
unpow229.3%
swap-sqr31.5%
unpow231.5%
Simplified31.5%
Final simplification31.5%
(FPCore (x y z t a b) :precision binary64 (if (<= t 2.75e-77) (* (* x (cos (/ (* z t) 16.0))) (cos (/ (* t b) 16.0))) (* x (expm1 (+ (log 2.0) (* -0.0009765625 (* (* t t) (* b b))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 2.75e-77) {
tmp = (x * cos(((z * t) / 16.0))) * cos(((t * b) / 16.0));
} else {
tmp = x * expm1((log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 2.75e-77) {
tmp = (x * Math.cos(((z * t) / 16.0))) * Math.cos(((t * b) / 16.0));
} else {
tmp = x * Math.expm1((Math.log(2.0) + (-0.0009765625 * ((t * t) * (b * b)))));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 2.75e-77: tmp = (x * math.cos(((z * t) / 16.0))) * math.cos(((t * b) / 16.0)) else: tmp = x * math.expm1((math.log(2.0) + (-0.0009765625 * ((t * t) * (b * b))))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 2.75e-77) tmp = Float64(Float64(x * cos(Float64(Float64(z * t) / 16.0))) * cos(Float64(Float64(t * b) / 16.0))); else tmp = Float64(x * expm1(Float64(log(2.0) + Float64(-0.0009765625 * Float64(Float64(t * t) * Float64(b * b)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 2.75e-77], N[(N[(x * N[Cos[N[(N[(z * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(t * b), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(x * N[(Exp[N[(N[Log[2.0], $MachinePrecision] + N[(-0.0009765625 * N[(N[(t * t), $MachinePrecision] * N[(b * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 2.75 \cdot 10^{-77}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{z \cdot t}{16}\right)\right) \cdot \cos \left(\frac{t \cdot b}{16}\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \mathsf{expm1}\left(\log 2 + -0.0009765625 \cdot \left(\left(t \cdot t\right) \cdot \left(b \cdot b\right)\right)\right)\\
\end{array}
\end{array}
if t < 2.74999999999999999e-77Initial program 32.0%
Taylor expanded in y around 0 34.1%
Taylor expanded in a around 0 35.1%
if 2.74999999999999999e-77 < t Initial program 15.4%
associate-*l*15.4%
*-commutative15.4%
*-commutative15.4%
associate-*l/15.4%
fma-def15.4%
associate-*l/15.4%
*-commutative15.4%
fma-def15.4%
Simplified15.4%
Taylor expanded in z around 0 17.9%
Taylor expanded in a around 0 18.9%
expm1-log1p-u18.9%
Applied egg-rr18.9%
Taylor expanded in t around 0 21.1%
unpow221.1%
unpow221.1%
Simplified21.1%
Final simplification30.8%
(FPCore (x y z t a b) :precision binary64 (* x (cos (* (* t b) 0.0625))))
double code(double x, double y, double z, double t, double a, double b) {
return x * cos(((t * b) * 0.0625));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * cos(((t * b) * 0.0625d0))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.cos(((t * b) * 0.0625));
}
def code(x, y, z, t, a, b): return x * math.cos(((t * b) * 0.0625))
function code(x, y, z, t, a, b) return Float64(x * cos(Float64(Float64(t * b) * 0.0625))) end
function tmp = code(x, y, z, t, a, b) tmp = x * cos(((t * b) * 0.0625)); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Cos[N[(N[(t * b), $MachinePrecision] * 0.0625), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \cos \left(\left(t \cdot b\right) \cdot 0.0625\right)
\end{array}
Initial program 26.9%
associate-*l*26.9%
*-commutative26.9%
*-commutative26.9%
associate-*l/26.9%
fma-def26.9%
associate-*l/26.9%
*-commutative26.9%
fma-def26.9%
Simplified26.9%
Taylor expanded in z around 0 28.9%
Taylor expanded in a around 0 30.0%
Final simplification30.0%
(FPCore (x y z t a b) :precision binary64 x)
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
def code(x, y, z, t, a, b): return x
function code(x, y, z, t, a, b) return x end
function tmp = code(x, y, z, t, a, b) tmp = x; end
code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 26.9%
associate-*l*26.9%
*-commutative26.9%
*-commutative26.9%
associate-*l/26.9%
fma-def26.9%
associate-*l/26.9%
*-commutative26.9%
fma-def26.9%
Simplified26.9%
Taylor expanded in z around 0 28.9%
Taylor expanded in b around 0 29.7%
Final simplification29.7%
(FPCore (x y z t a b) :precision binary64 (* x (cos (* (/ b 16.0) (/ t (+ (- 1.0 (* a 2.0)) (pow (* a 2.0) 2.0)))))))
double code(double x, double y, double z, double t, double a, double b) {
return x * cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + pow((a * 2.0), 2.0)))));
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * cos(((b / 16.0d0) * (t / ((1.0d0 - (a * 2.0d0)) + ((a * 2.0d0) ** 2.0d0)))))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return x * Math.cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + Math.pow((a * 2.0), 2.0)))));
}
def code(x, y, z, t, a, b): return x * math.cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + math.pow((a * 2.0), 2.0)))))
function code(x, y, z, t, a, b) return Float64(x * cos(Float64(Float64(b / 16.0) * Float64(t / Float64(Float64(1.0 - Float64(a * 2.0)) + (Float64(a * 2.0) ^ 2.0)))))) end
function tmp = code(x, y, z, t, a, b) tmp = x * cos(((b / 16.0) * (t / ((1.0 - (a * 2.0)) + ((a * 2.0) ^ 2.0))))); end
code[x_, y_, z_, t_, a_, b_] := N[(x * N[Cos[N[(N[(b / 16.0), $MachinePrecision] * N[(t / N[(N[(1.0 - N[(a * 2.0), $MachinePrecision]), $MachinePrecision] + N[Power[N[(a * 2.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right)
\end{array}
herbie shell --seed 2023274
(FPCore (x y z t a b)
:name "Codec.Picture.Jpg.FastDct:referenceDct from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* x (cos (* (/ b 16.0) (/ t (+ (- 1.0 (* a 2.0)) (pow (* a 2.0) 2.0))))))
(* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))