?

Average Error: 46.5 → 43.7
Time: 43.2s
Precision: binary64
Cost: 42116

?

\[\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) \]
\[\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{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \leq 10^{+277}:\\ \;\;\;\;x \cdot \left(\sin \left(\frac{\left(\left(y + y\right) + 1\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right) \cdot \sin \left(\frac{\pi}{2} - \frac{t \cdot \left(\left(1 + \left(a + a\right)\right) \cdot b\right)}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
(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))))
(FPCore (x y z t a b)
 :precision binary64
 (if (<=
      (*
       (* x (cos (/ (* (* (+ (* y 2.0) 1.0) z) t) 16.0)))
       (cos (/ (* (* (+ (* a 2.0) 1.0) b) t) 16.0)))
      1e+277)
   (*
    x
    (*
     (sin (- (/ (* (+ (+ y y) 1.0) (* z t)) 16.0) (- (/ PI 2.0))))
     (sin (- (/ PI 2.0) (/ (* t (* (+ 1.0 (+ a a)) b)) 16.0)))))
   x))
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));
}
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((((((a * 2.0) + 1.0) * b) * t) / 16.0))) <= 1e+277) {
		tmp = x * (sin((((((y + y) + 1.0) * (z * t)) / 16.0) - -(((double) M_PI) / 2.0))) * sin(((((double) M_PI) / 2.0) - ((t * ((1.0 + (a + a)) * b)) / 16.0))));
	} else {
		tmp = x;
	}
	return tmp;
}
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));
}
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((((((a * 2.0) + 1.0) * b) * t) / 16.0))) <= 1e+277) {
		tmp = x * (Math.sin((((((y + y) + 1.0) * (z * t)) / 16.0) - -(Math.PI / 2.0))) * Math.sin(((Math.PI / 2.0) - ((t * ((1.0 + (a + a)) * b)) / 16.0))));
	} else {
		tmp = x;
	}
	return tmp;
}
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))
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((((((a * 2.0) + 1.0) * b) * t) / 16.0))) <= 1e+277:
		tmp = x * (math.sin((((((y + y) + 1.0) * (z * t)) / 16.0) - -(math.pi / 2.0))) * math.sin(((math.pi / 2.0) - ((t * ((1.0 + (a + a)) * b)) / 16.0))))
	else:
		tmp = x
	return tmp
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 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(Float64(Float64(Float64(a * 2.0) + 1.0) * b) * t) / 16.0))) <= 1e+277)
		tmp = Float64(x * Float64(sin(Float64(Float64(Float64(Float64(Float64(y + y) + 1.0) * Float64(z * t)) / 16.0) - Float64(-Float64(pi / 2.0)))) * sin(Float64(Float64(pi / 2.0) - Float64(Float64(t * Float64(Float64(1.0 + Float64(a + a)) * b)) / 16.0)))));
	else
		tmp = x;
	end
	return tmp
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
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((((((a * 2.0) + 1.0) * b) * t) / 16.0))) <= 1e+277)
		tmp = x * (sin((((((y + y) + 1.0) * (z * t)) / 16.0) - -(pi / 2.0))) * sin(((pi / 2.0) - ((t * ((1.0 + (a + a)) * b)) / 16.0))));
	else
		tmp = x;
	end
	tmp_2 = tmp;
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]
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[(N[(N[(N[(a * 2.0), $MachinePrecision] + 1.0), $MachinePrecision] * b), $MachinePrecision] * t), $MachinePrecision] / 16.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e+277], N[(x * N[(N[Sin[N[(N[(N[(N[(N[(y + y), $MachinePrecision] + 1.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision] - (-N[(Pi / 2.0), $MachinePrecision])), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(N[(Pi / 2.0), $MachinePrecision] - N[(N[(t * N[(N[(1.0 + N[(a + a), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision] / 16.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\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)
\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{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \leq 10^{+277}:\\
\;\;\;\;x \cdot \left(\sin \left(\frac{\left(\left(y + y\right) + 1\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right) \cdot \sin \left(\frac{\pi}{2} - \frac{t \cdot \left(\left(1 + \left(a + a\right)\right) \cdot b\right)}{16}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;x\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original46.5
Target44.6
Herbie43.7
\[x \cdot \cos \left(\frac{b}{16} \cdot \frac{t}{\left(1 - a \cdot 2\right) + {\left(a \cdot 2\right)}^{2}}\right) \]

Derivation?

  1. Split input into 2 regimes
  2. 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))) < 1e277

    1. Initial program 34.5

      \[\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) \]
    2. Simplified34.5

      \[\leadsto \color{blue}{x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + 2 \cdot a\right) \cdot b\right)}{16}\right)\right)} \]
      Proof

      [Start]34.5

      \[ \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) \]

      rational.json-simplify-2 [=>]34.5

      \[ \color{blue}{\cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \cdot \left(x \cdot \cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right)\right)} \]

      rational.json-simplify-43 [=>]34.5

      \[ \color{blue}{x \cdot \left(\cos \left(\frac{\left(\left(y \cdot 2 + 1\right) \cdot z\right) \cdot t}{16}\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\right)} \]

      rational.json-simplify-2 [=>]34.5

      \[ x \cdot \left(\cos \left(\frac{\color{blue}{t \cdot \left(\left(y \cdot 2 + 1\right) \cdot z\right)}}{16}\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\right) \]

      rational.json-simplify-43 [=>]34.5

      \[ x \cdot \left(\cos \left(\frac{\color{blue}{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}}{16}\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right)\right) \]

      rational.json-simplify-2 [=>]34.5

      \[ x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \cos \left(\frac{\color{blue}{t \cdot \left(\left(a \cdot 2 + 1\right) \cdot b\right)}}{16}\right)\right) \]

      rational.json-simplify-1 [=>]34.5

      \[ x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \cos \left(\frac{t \cdot \left(\color{blue}{\left(1 + a \cdot 2\right)} \cdot b\right)}{16}\right)\right) \]

      rational.json-simplify-2 [=>]34.5

      \[ x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \cos \left(\frac{t \cdot \left(\left(1 + \color{blue}{2 \cdot a}\right) \cdot b\right)}{16}\right)\right) \]
    3. Applied egg-rr34.4

      \[\leadsto x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \color{blue}{\sin \left(\frac{\pi}{2} - \frac{t \cdot \left(\left(1 + \left(a + a\right)\right) \cdot b\right)}{16}\right)}\right) \]
    4. Applied egg-rr34.5

      \[\leadsto x \cdot \left(\color{blue}{\sin \left(\frac{\left(\left(y + y\right) + 1\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right)} \cdot \sin \left(\frac{\pi}{2} - \frac{t \cdot \left(\left(1 + \left(a + a\right)\right) \cdot b\right)}{16}\right)\right) \]

    if 1e277 < (*.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. Initial program 62.9

      \[\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) \]
    2. Taylor expanded in z around 0 60.3

      \[\leadsto \left(x \cdot \color{blue}{1}\right) \cdot \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \]
    3. Taylor expanded in b around 0 56.2

      \[\leadsto \color{blue}{x} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification43.7

    \[\leadsto \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{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \leq 10^{+277}:\\ \;\;\;\;x \cdot \left(\sin \left(\frac{\left(\left(y + y\right) + 1\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right) \cdot \sin \left(\frac{\pi}{2} - \frac{t \cdot \left(\left(1 + \left(a + a\right)\right) \cdot b\right)}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]

Alternatives

Alternative 1
Error43.7
Cost35524
\[\begin{array}{l} t_1 := \cos \left(\frac{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{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 2 \cdot 10^{+268}:\\ \;\;\;\;\left(x \cdot \sin \left(\frac{\left(y + \left(y + 1\right)\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right)\right) \cdot t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error44.0
Cost35140
\[\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{\left(\left(a \cdot 2 + 1\right) \cdot b\right) \cdot t}{16}\right) \leq 5 \cdot 10^{+243}:\\ \;\;\;\;x \cdot \left(\sin \left(\frac{\left(\left(y + y\right) + 1\right) \cdot \left(z \cdot t\right)}{16} - \left(-\frac{\pi}{2}\right)\right) \cdot \cos \left(\frac{t \cdot b}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error43.7
Cost28868
\[\begin{array}{l} t_1 := \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)\\ \mathbf{if}\;t_1 \leq 5 \cdot 10^{+286}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error44.1
Cost14664
\[\begin{array}{l} \mathbf{if}\;t \leq -1.6 \cdot 10^{-180}:\\ \;\;\;\;x\\ \mathbf{elif}\;t \leq 2.7 \cdot 10^{-67}:\\ \;\;\;\;x \cdot \left(\cos \left(\frac{\left(y \cdot 2 + 1\right) \cdot \left(z \cdot t\right)}{16}\right) \cdot \cos \left(\frac{b \cdot \left(t \cdot \left(1 + \left(a + a\right)\right)\right)}{16}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error44.5
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023077 
(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))))