
(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}
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
(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)))
2e+305)
(*
x
(*
(cos (* (/ (fma y 2.0 1.0) 16.0) (* z t)))
(cos (expm1 (log1p (* t (* b 0.0625)))))))
x))t = abs(t);
b = abs(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))) <= 2e+305) {
tmp = x * (cos(((fma(y, 2.0, 1.0) / 16.0) * (z * t))) * cos(expm1(log1p((t * (b * 0.0625))))));
} else {
tmp = x;
}
return tmp;
}
t = abs(t) b = abs(b) 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))) <= 2e+305) tmp = Float64(x * Float64(cos(Float64(Float64(fma(y, 2.0, 1.0) / 16.0) * Float64(z * t))) * cos(expm1(log1p(Float64(t * Float64(b * 0.0625))))))); else tmp = x; end return tmp end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function 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], 2e+305], N[(x * N[(N[Cos[N[(N[(N[(y * 2.0 + 1.0), $MachinePrecision] / 16.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(Exp[N[Log[1 + N[(t * N[(b * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
\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 2 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{16} \cdot \left(z \cdot t\right)\right) \cdot \cos \left(\mathsf{expm1}\left(\mathsf{log1p}\left(t \cdot \left(b \cdot 0.0625\right)\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\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.9999999999999999e305Initial program 49.0%
Simplified49.1%
expm1-log1p-u46.2%
*-commutative46.2%
*-commutative46.2%
div-inv46.2%
metadata-eval46.2%
Applied egg-rr46.2%
Taylor expanded in a around 0 46.7%
log1p-def46.7%
*-commutative46.7%
*-commutative46.7%
associate-*r*46.7%
Simplified46.7%
if 1.9999999999999999e305 < (*.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 0.0%
Simplified2.1%
Taylor expanded in t around 0 5.4%
Taylor expanded in t around 0 12.6%
Final simplification33.9%
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
(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)))
4e+186)
(*
x
(* (cos (* b (* t 0.0625))) (cos (* z (/ (fma y 2.0 1.0) (/ 16.0 t))))))
x))t = abs(t);
b = abs(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))) <= 4e+186) {
tmp = x * (cos((b * (t * 0.0625))) * cos((z * (fma(y, 2.0, 1.0) / (16.0 / t)))));
} else {
tmp = x;
}
return tmp;
}
t = abs(t) b = abs(b) 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))) <= 4e+186) tmp = Float64(x * Float64(cos(Float64(b * Float64(t * 0.0625))) * cos(Float64(z * Float64(fma(y, 2.0, 1.0) / Float64(16.0 / t)))))); else tmp = x; end return tmp end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function 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], 4e+186], N[(x * N[(N[Cos[N[(b * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[(16.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
\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 4 \cdot 10^{+186}:\\
\;\;\;\;x \cdot \left(\cos \left(b \cdot \left(t \cdot 0.0625\right)\right) \cdot \cos \left(z \cdot \frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{16}{t}}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\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))) < 3.99999999999999992e186Initial program 51.4%
Simplified51.3%
Taylor expanded in a around 0 51.9%
*-commutative51.9%
associate-*l*51.9%
*-commutative51.9%
Simplified51.9%
associate-/r/51.6%
Applied egg-rr51.6%
if 3.99999999999999992e186 < (*.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 5.2%
Simplified7.1%
Taylor expanded in t around 0 9.1%
Taylor expanded in t around 0 15.9%
Final simplification35.6%
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
(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)))
2e+305)
(*
x
(* (cos (/ (fma y 2.0 1.0) (/ (/ 16.0 t) z))) (cos (* b (* t 0.0625)))))
x))t = abs(t);
b = abs(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))) <= 2e+305) {
tmp = x * (cos((fma(y, 2.0, 1.0) / ((16.0 / t) / z))) * cos((b * (t * 0.0625))));
} else {
tmp = x;
}
return tmp;
}
t = abs(t) b = abs(b) 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))) <= 2e+305) tmp = Float64(x * Float64(cos(Float64(fma(y, 2.0, 1.0) / Float64(Float64(16.0 / t) / z))) * cos(Float64(b * Float64(t * 0.0625))))); else tmp = x; end return tmp end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function 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], 2e+305], N[(x * N[(N[Cos[N[(N[(y * 2.0 + 1.0), $MachinePrecision] / N[(N[(16.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(b * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
\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 2 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \left(\cos \left(\frac{\mathsf{fma}\left(y, 2, 1\right)}{\frac{\frac{16}{t}}{z}}\right) \cdot \cos \left(b \cdot \left(t \cdot 0.0625\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\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.9999999999999999e305Initial program 49.0%
Simplified49.1%
Taylor expanded in a around 0 49.7%
*-commutative49.7%
associate-*l*49.7%
*-commutative49.7%
Simplified49.7%
if 1.9999999999999999e305 < (*.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 0.0%
Simplified2.1%
Taylor expanded in t around 0 5.4%
Taylor expanded in t around 0 12.6%
Final simplification35.8%
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
(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)))
2e+305)
(*
x
(*
(cos (* b (* t 0.0625)))
(cos (+ (* 0.0625 (* z t)) (* 0.125 (* t (* y z)))))))
x))t = abs(t);
b = abs(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))) <= 2e+305) {
tmp = x * (cos((b * (t * 0.0625))) * cos(((0.0625 * (z * t)) + (0.125 * (t * (y * z))))));
} else {
tmp = x;
}
return tmp;
}
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
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
real(8) :: tmp
if (((x * cos((((((y * 2.0d0) + 1.0d0) * z) * t) / 16.0d0))) * cos(((t * ((1.0d0 + (2.0d0 * a)) * b)) / 16.0d0))) <= 2d+305) then
tmp = x * (cos((b * (t * 0.0625d0))) * cos(((0.0625d0 * (z * t)) + (0.125d0 * (t * (y * z))))))
else
tmp = x
end if
code = tmp
end function
t = Math.abs(t);
b = Math.abs(b);
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((x * Math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * Math.cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 2e+305) {
tmp = x * (Math.cos((b * (t * 0.0625))) * Math.cos(((0.0625 * (z * t)) + (0.125 * (t * (y * z))))));
} else {
tmp = x;
}
return tmp;
}
t = abs(t) b = abs(b) def code(x, y, z, t, a, b): tmp = 0 if ((x * math.cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * math.cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 2e+305: tmp = x * (math.cos((b * (t * 0.0625))) * math.cos(((0.0625 * (z * t)) + (0.125 * (t * (y * z)))))) else: tmp = x return tmp
t = abs(t) b = abs(b) 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))) <= 2e+305) tmp = Float64(x * Float64(cos(Float64(b * Float64(t * 0.0625))) * cos(Float64(Float64(0.0625 * Float64(z * t)) + Float64(0.125 * Float64(t * Float64(y * z))))))); else tmp = x; end return tmp end
t = abs(t) b = abs(b) function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (((x * cos((((((y * 2.0) + 1.0) * z) * t) / 16.0))) * cos(((t * ((1.0 + (2.0 * a)) * b)) / 16.0))) <= 2e+305) tmp = x * (cos((b * (t * 0.0625))) * cos(((0.0625 * (z * t)) + (0.125 * (t * (y * z)))))); else tmp = x; end tmp_2 = tmp; end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function 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], 2e+305], N[(x * N[(N[Cos[N[(b * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(0.0625 * N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(0.125 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
\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 2 \cdot 10^{+305}:\\
\;\;\;\;x \cdot \left(\cos \left(b \cdot \left(t \cdot 0.0625\right)\right) \cdot \cos \left(0.0625 \cdot \left(z \cdot t\right) + 0.125 \cdot \left(t \cdot \left(y \cdot z\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\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.9999999999999999e305Initial program 49.0%
Simplified49.1%
Taylor expanded in a around 0 49.7%
*-commutative49.7%
associate-*l*49.7%
*-commutative49.7%
Simplified49.7%
Taylor expanded in y around 0 49.2%
if 1.9999999999999999e305 < (*.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 0.0%
Simplified2.1%
Taylor expanded in t around 0 5.4%
Taylor expanded in t around 0 12.6%
Final simplification35.5%
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function (FPCore (x y z t a b) :precision binary64 (if (<= t 3.2e-89) (* x (* (cos (* b (* t 0.0625))) (cos (* z (* t 0.0625))))) x))
t = abs(t);
b = abs(b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.2e-89) {
tmp = x * (cos((b * (t * 0.0625))) * cos((z * (t * 0.0625))));
} else {
tmp = x;
}
return tmp;
}
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
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
real(8) :: tmp
if (t <= 3.2d-89) then
tmp = x * (cos((b * (t * 0.0625d0))) * cos((z * (t * 0.0625d0))))
else
tmp = x
end if
code = tmp
end function
t = Math.abs(t);
b = Math.abs(b);
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.2e-89) {
tmp = x * (Math.cos((b * (t * 0.0625))) * Math.cos((z * (t * 0.0625))));
} else {
tmp = x;
}
return tmp;
}
t = abs(t) b = abs(b) def code(x, y, z, t, a, b): tmp = 0 if t <= 3.2e-89: tmp = x * (math.cos((b * (t * 0.0625))) * math.cos((z * (t * 0.0625)))) else: tmp = x return tmp
t = abs(t) b = abs(b) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 3.2e-89) tmp = Float64(x * Float64(cos(Float64(b * Float64(t * 0.0625))) * cos(Float64(z * Float64(t * 0.0625))))); else tmp = x; end return tmp end
t = abs(t) b = abs(b) function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 3.2e-89) tmp = x * (cos((b * (t * 0.0625))) * cos((z * (t * 0.0625)))); else tmp = x; end tmp_2 = tmp; end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 3.2e-89], N[(x * N[(N[Cos[N[(b * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * N[(t * 0.0625), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.2 \cdot 10^{-89}:\\
\;\;\;\;x \cdot \left(\cos \left(b \cdot \left(t \cdot 0.0625\right)\right) \cdot \cos \left(z \cdot \left(t \cdot 0.0625\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < 3.19999999999999998e-89Initial program 39.3%
Simplified40.0%
Taylor expanded in a around 0 40.4%
*-commutative40.4%
associate-*l*40.4%
*-commutative40.4%
Simplified40.4%
Taylor expanded in y around 0 41.0%
associate-*r*41.0%
Simplified41.0%
if 3.19999999999999998e-89 < t Initial program 12.3%
Simplified13.3%
Taylor expanded in t around 0 13.1%
Taylor expanded in t around 0 17.6%
Final simplification33.5%
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function (FPCore (x y z t a b) :precision binary64 x)
t = abs(t);
b = abs(b);
double code(double x, double y, double z, double t, double a, double b) {
return x;
}
NOTE: t should be positive before calling this function
NOTE: b should be positive before calling this function
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
t = Math.abs(t);
b = Math.abs(b);
public static double code(double x, double y, double z, double t, double a, double b) {
return x;
}
t = abs(t) b = abs(b) def code(x, y, z, t, a, b): return x
t = abs(t) b = abs(b) function code(x, y, z, t, a, b) return x end
t = abs(t) b = abs(b) function tmp = code(x, y, z, t, a, b) tmp = x; end
NOTE: t should be positive before calling this function NOTE: b should be positive before calling this function code[x_, y_, z_, t_, a_, b_] := x
\begin{array}{l}
t = |t|\\
b = |b|\\
\\
x
\end{array}
Initial program 30.6%
Simplified31.5%
Taylor expanded in t around 0 30.7%
Taylor expanded in t around 0 32.9%
Final simplification32.9%
(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 2023308
(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))))