
(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 12 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}
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0)))
(cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0)))
2e+262)
(*
(* x (cos (/ (* (fma 2.0 y 1.0) (* t_m z)) 16.0)))
(sin (+ (/ (* (* b_m (fma 2.0 a 1.0)) t_m) -16.0) (/ (PI) 2.0))))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right) \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{\mathsf{fma}\left(2, y, 1\right) \cdot \left(t\_m \cdot z\right)}{16}\right)\right) \cdot \sin \left(\frac{\left(b\_m \cdot \mathsf{fma}\left(2, a, 1\right)\right) \cdot t\_m}{-16} + \frac{\mathsf{PI}\left(\right)}{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2e262Initial program 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-PI.f64N/A
lift-/.f64N/A
lower-+.f64N/A
Applied rewrites49.4%
if 2e262 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 1.2%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites1.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6412.3
Applied rewrites12.3%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(let* ((t_1 (cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0))))
(if (<= (* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0))) t_1) 2e+262)
(* (* x (cos (/ (* (fma 2.0 y 1.0) (* t_m z)) 16.0))) t_1)
(* (sin (* (PI) 0.5)) x))))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
t_1 := \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right)\\
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot t\_1 \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{\mathsf{fma}\left(2, y, 1\right) \cdot \left(t\_m \cdot z\right)}{16}\right)\right) \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2e262Initial program 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
if 2e262 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 1.2%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites1.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6412.3
Applied rewrites12.3%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0)))
(cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0)))
2e+262)
(*
(* (cos (/ (* (* b_m (fma 2.0 a 1.0)) t_m) -16.0)) x)
(cos (/ (* (* z (fma y 2.0 1.0)) t_m) -16.0)))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right) \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\left(\cos \left(\frac{\left(b\_m \cdot \mathsf{fma}\left(2, a, 1\right)\right) \cdot t\_m}{-16}\right) \cdot x\right) \cdot \cos \left(\frac{\left(z \cdot \mathsf{fma}\left(y, 2, 1\right)\right) \cdot t\_m}{-16}\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2e262Initial program 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
Applied rewrites49.0%
if 2e262 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 1.2%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites1.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6412.3
Applied rewrites12.3%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0)))
(cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0)))
2e+262)
(*
(* x (cos (/ (* (fma 2.0 y 1.0) (* t_m z)) 16.0)))
(sin (fma (* b_m t_m) -0.0625 (/ (PI) 2.0))))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right) \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{\mathsf{fma}\left(2, y, 1\right) \cdot \left(t\_m \cdot z\right)}{16}\right)\right) \cdot \sin \left(\mathsf{fma}\left(b\_m \cdot t\_m, -0.0625, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2e262Initial program 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
cos-neg-revN/A
lower-cos.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6448.1
Applied rewrites48.1%
Applied rewrites48.5%
if 2e262 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 1.2%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites1.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6412.3
Applied rewrites12.3%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0)))
(cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0)))
2e+306)
(*
(* (cos (* (* b_m t_m) 0.0625)) x)
(sin (fma (PI) 0.5 (* -0.0625 (* (* (fma y 2.0 1.0) z) t_m)))))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right) \leq 2 \cdot 10^{+306}:\\
\;\;\;\;\left(\cos \left(\left(b\_m \cdot t\_m\right) \cdot 0.0625\right) \cdot x\right) \cdot \sin \left(\mathsf{fma}\left(\mathsf{PI}\left(\right), 0.5, -0.0625 \cdot \left(\left(\mathsf{fma}\left(y, 2, 1\right) \cdot z\right) \cdot t\_m\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2.00000000000000003e306Initial program 47.6%
lift-cos.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
distribute-neg-frac2N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
associate-*r*N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites46.6%
Taylor expanded in a around 0
associate-*r*N/A
metadata-evalN/A
distribute-lft-neg-inN/A
cos-neg-revN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
cos-neg-revN/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-cos.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
lower-sin.f64N/A
Applied rewrites46.9%
if 2.00000000000000003e306 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 0.0%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites0.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6411.6
Applied rewrites11.6%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<=
(*
(* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t_m) 16.0)))
(cos (/ (* (* (+ (* a 2.0) 1.0) b_m) t_m) 16.0)))
2e+262)
(*
(* x (cos (* (* b_m t_m) -0.0625)))
(cos (* -0.0625 (* (* (fma 2.0 y 1.0) z) t_m))))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t\_m}{16}\right)\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\_m\right) \cdot t\_m}{16}\right) \leq 2 \cdot 10^{+262}:\\
\;\;\;\;\left(x \cdot \cos \left(\left(b\_m \cdot t\_m\right) \cdot -0.0625\right)\right) \cdot \cos \left(-0.0625 \cdot \left(\left(\mathsf{fma}\left(2, y, 1\right) \cdot z\right) \cdot t\_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) < 2e262Initial program 49.0%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6449.0
Applied rewrites49.0%
Taylor expanded in a around 0
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites48.0%
if 2e262 < (*.f64 (*.f64 x (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 y #s(literal 2 binary64)) #s(literal 1 binary64)) z) t) #s(literal 16 binary64)))) (cos.f64 (/.f64 (*.f64 (*.f64 (+.f64 (*.f64 a #s(literal 2 binary64)) #s(literal 1 binary64)) b) t) #s(literal 16 binary64)))) Initial program 1.2%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites1.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6412.3
Applied rewrites12.3%
b_m = (fabs.f64 b)
t_m = (fabs.f64 t)
(FPCore (x y z t_m a b_m)
:precision binary64
(if (<= t_m 2.9e-50)
(*
(* x (cos (/ (* (fma 2.0 y 1.0) (* t_m z)) 16.0)))
(sin (fma 0.0625 (* b_m t_m) (/ (PI) 2.0))))
(* (sin (* (PI) 0.5)) x)))\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\begin{array}{l}
\mathbf{if}\;t\_m \leq 2.9 \cdot 10^{-50}:\\
\;\;\;\;\left(x \cdot \cos \left(\frac{\mathsf{fma}\left(2, y, 1\right) \cdot \left(t\_m \cdot z\right)}{16}\right)\right) \cdot \sin \left(\mathsf{fma}\left(0.0625, b\_m \cdot t\_m, \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x\\
\end{array}
\end{array}
if t < 2.90000000000000008e-50Initial program 32.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6433.5
Applied rewrites33.5%
Taylor expanded in a around 0
cos-neg-revN/A
lower-cos.f64N/A
*-commutativeN/A
distribute-rgt-neg-inN/A
metadata-evalN/A
lower-*.f64N/A
lower-*.f6433.6
Applied rewrites33.6%
Applied rewrites34.0%
if 2.90000000000000008e-50 < t Initial program 15.1%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites16.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6421.3
Applied rewrites21.3%
b_m = (fabs.f64 b) t_m = (fabs.f64 t) (FPCore (x y z t_m a b_m) :precision binary64 (* (sin (* (PI) 0.5)) x))
\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\sin \left(\mathsf{PI}\left(\right) \cdot 0.5\right) \cdot x
\end{array}
Initial program 27.7%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-/.f64N/A
lift-*.f64N/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites27.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-*.f64N/A
lower-sin.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6430.5
Applied rewrites30.5%
b_m = (fabs.f64 b) t_m = (fabs.f64 t) (FPCore (x y z t_m a b_m) :precision binary64 (fma (* (* t_m t_m) x) (* -0.001953125 (* (* 4.0 (* y y)) (* z z))) x))
b_m = fabs(b);
t_m = fabs(t);
double code(double x, double y, double z, double t_m, double a, double b_m) {
return fma(((t_m * t_m) * x), (-0.001953125 * ((4.0 * (y * y)) * (z * z))), x);
}
b_m = abs(b) t_m = abs(t) function code(x, y, z, t_m, a, b_m) return fma(Float64(Float64(t_m * t_m) * x), Float64(-0.001953125 * Float64(Float64(4.0 * Float64(y * y)) * Float64(z * z))), x) end
b_m = N[Abs[b], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_, a_, b$95$m_] := N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * x), $MachinePrecision] * N[(-0.001953125 * N[(N[(4.0 * N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(z * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\mathsf{fma}\left(\left(t\_m \cdot t\_m\right) \cdot x, -0.001953125 \cdot \left(\left(4 \cdot \left(y \cdot y\right)\right) \cdot \left(z \cdot z\right)\right), x\right)
\end{array}
Initial program 27.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6428.2
Applied rewrites28.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites13.9%
Taylor expanded in y around inf
Applied rewrites20.5%
b_m = (fabs.f64 b) t_m = (fabs.f64 t) (FPCore (x y z t_m a b_m) :precision binary64 (* (* (* (* (* (* a a) -0.0078125) t_m) (* t_m x)) b_m) b_m))
b_m = fabs(b);
t_m = fabs(t);
double code(double x, double y, double z, double t_m, double a, double b_m) {
return (((((a * a) * -0.0078125) * t_m) * (t_m * x)) * b_m) * b_m;
}
b_m = abs(b)
t_m = abs(t)
real(8) function code(x, y, z, t_m, a, b_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8), intent (in) :: a
real(8), intent (in) :: b_m
code = (((((a * a) * (-0.0078125d0)) * t_m) * (t_m * x)) * b_m) * b_m
end function
b_m = Math.abs(b);
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m, double a, double b_m) {
return (((((a * a) * -0.0078125) * t_m) * (t_m * x)) * b_m) * b_m;
}
b_m = math.fabs(b) t_m = math.fabs(t) def code(x, y, z, t_m, a, b_m): return (((((a * a) * -0.0078125) * t_m) * (t_m * x)) * b_m) * b_m
b_m = abs(b) t_m = abs(t) function code(x, y, z, t_m, a, b_m) return Float64(Float64(Float64(Float64(Float64(Float64(a * a) * -0.0078125) * t_m) * Float64(t_m * x)) * b_m) * b_m) end
b_m = abs(b); t_m = abs(t); function tmp = code(x, y, z, t_m, a, b_m) tmp = (((((a * a) * -0.0078125) * t_m) * (t_m * x)) * b_m) * b_m; end
b_m = N[Abs[b], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_, a_, b$95$m_] := N[(N[(N[(N[(N[(N[(a * a), $MachinePrecision] * -0.0078125), $MachinePrecision] * t$95$m), $MachinePrecision] * N[(t$95$m * x), $MachinePrecision]), $MachinePrecision] * b$95$m), $MachinePrecision] * b$95$m), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\left(\left(\left(\left(\left(a \cdot a\right) \cdot -0.0078125\right) \cdot t\_m\right) \cdot \left(t\_m \cdot x\right)\right) \cdot b\_m\right) \cdot b\_m
\end{array}
Initial program 27.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6428.2
Applied rewrites28.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites13.9%
Taylor expanded in a around inf
Applied rewrites2.1%
Applied rewrites3.0%
b_m = (fabs.f64 b) t_m = (fabs.f64 t) (FPCore (x y z t_m a b_m) :precision binary64 (* (* (* (* a a) -0.0078125) (* (* (* t_m t_m) x) b_m)) b_m))
b_m = fabs(b);
t_m = fabs(t);
double code(double x, double y, double z, double t_m, double a, double b_m) {
return (((a * a) * -0.0078125) * (((t_m * t_m) * x) * b_m)) * b_m;
}
b_m = abs(b)
t_m = abs(t)
real(8) function code(x, y, z, t_m, a, b_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8), intent (in) :: a
real(8), intent (in) :: b_m
code = (((a * a) * (-0.0078125d0)) * (((t_m * t_m) * x) * b_m)) * b_m
end function
b_m = Math.abs(b);
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m, double a, double b_m) {
return (((a * a) * -0.0078125) * (((t_m * t_m) * x) * b_m)) * b_m;
}
b_m = math.fabs(b) t_m = math.fabs(t) def code(x, y, z, t_m, a, b_m): return (((a * a) * -0.0078125) * (((t_m * t_m) * x) * b_m)) * b_m
b_m = abs(b) t_m = abs(t) function code(x, y, z, t_m, a, b_m) return Float64(Float64(Float64(Float64(a * a) * -0.0078125) * Float64(Float64(Float64(t_m * t_m) * x) * b_m)) * b_m) end
b_m = abs(b); t_m = abs(t); function tmp = code(x, y, z, t_m, a, b_m) tmp = (((a * a) * -0.0078125) * (((t_m * t_m) * x) * b_m)) * b_m; end
b_m = N[Abs[b], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_, a_, b$95$m_] := N[(N[(N[(N[(a * a), $MachinePrecision] * -0.0078125), $MachinePrecision] * N[(N[(N[(t$95$m * t$95$m), $MachinePrecision] * x), $MachinePrecision] * b$95$m), $MachinePrecision]), $MachinePrecision] * b$95$m), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\left(\left(\left(a \cdot a\right) \cdot -0.0078125\right) \cdot \left(\left(\left(t\_m \cdot t\_m\right) \cdot x\right) \cdot b\_m\right)\right) \cdot b\_m
\end{array}
Initial program 27.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6428.2
Applied rewrites28.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites13.9%
Taylor expanded in a around inf
Applied rewrites2.1%
Applied rewrites2.7%
b_m = (fabs.f64 b) t_m = (fabs.f64 t) (FPCore (x y z t_m a b_m) :precision binary64 (* (* -0.0078125 (* a a)) (* t_m (* t_m (* (* b_m b_m) x)))))
b_m = fabs(b);
t_m = fabs(t);
double code(double x, double y, double z, double t_m, double a, double b_m) {
return (-0.0078125 * (a * a)) * (t_m * (t_m * ((b_m * b_m) * x)));
}
b_m = abs(b)
t_m = abs(t)
real(8) function code(x, y, z, t_m, a, b_m)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t_m
real(8), intent (in) :: a
real(8), intent (in) :: b_m
code = ((-0.0078125d0) * (a * a)) * (t_m * (t_m * ((b_m * b_m) * x)))
end function
b_m = Math.abs(b);
t_m = Math.abs(t);
public static double code(double x, double y, double z, double t_m, double a, double b_m) {
return (-0.0078125 * (a * a)) * (t_m * (t_m * ((b_m * b_m) * x)));
}
b_m = math.fabs(b) t_m = math.fabs(t) def code(x, y, z, t_m, a, b_m): return (-0.0078125 * (a * a)) * (t_m * (t_m * ((b_m * b_m) * x)))
b_m = abs(b) t_m = abs(t) function code(x, y, z, t_m, a, b_m) return Float64(Float64(-0.0078125 * Float64(a * a)) * Float64(t_m * Float64(t_m * Float64(Float64(b_m * b_m) * x)))) end
b_m = abs(b); t_m = abs(t); function tmp = code(x, y, z, t_m, a, b_m) tmp = (-0.0078125 * (a * a)) * (t_m * (t_m * ((b_m * b_m) * x))); end
b_m = N[Abs[b], $MachinePrecision] t_m = N[Abs[t], $MachinePrecision] code[x_, y_, z_, t$95$m_, a_, b$95$m_] := N[(N[(-0.0078125 * N[(a * a), $MachinePrecision]), $MachinePrecision] * N[(t$95$m * N[(t$95$m * N[(N[(b$95$m * b$95$m), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
b_m = \left|b\right|
\\
t_m = \left|t\right|
\\
\left(-0.0078125 \cdot \left(a \cdot a\right)\right) \cdot \left(t\_m \cdot \left(t\_m \cdot \left(\left(b\_m \cdot b\_m\right) \cdot x\right)\right)\right)
\end{array}
Initial program 27.7%
lift-*.f64N/A
lift-*.f64N/A
associate-*l*N/A
lower-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6428.2
Applied rewrites28.2%
Taylor expanded in t around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites13.9%
Taylor expanded in a around inf
Applied rewrites2.1%
Applied rewrites2.5%
(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 2024319
(FPCore (x y z t a b)
:name "Codec.Picture.Jpg.FastDct:referenceDct from JuicyPixels-3.2.6.1"
:precision binary64
:alt
(! :herbie-platform default (* x (cos (* (/ b 16) (/ t (+ (- 1 (* a 2)) (pow (* a 2) 2)))))))
(* (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0))) (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0))))