?

Average Accuracy: 67.7% → 71.3%
Time: 14.6s
Precision: binary64
Cost: 3016

?

\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \frac{t}{y}\\ \mathbf{elif}\;t_1 \leq 10^{+289}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \end{array} \]
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
 :precision binary64
 (let* ((t_1 (+ (- x (/ y (* z 3.0))) (/ t (* y (* z 3.0))))))
   (if (<= t_1 (- INFINITY))
     (+ x (* (/ 0.3333333333333333 z) (/ t y)))
     (if (<= t_1 1e+289) t_1 (+ x (/ (- y (/ t y)) (* z -3.0)))))))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
	double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = x + ((0.3333333333333333 / z) * (t / y));
	} else if (t_1 <= 1e+289) {
		tmp = t_1;
	} else {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	}
	return tmp;
}
public static double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
public static double code(double x, double y, double z, double t) {
	double t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
	double tmp;
	if (t_1 <= -Double.POSITIVE_INFINITY) {
		tmp = x + ((0.3333333333333333 / z) * (t / y));
	} else if (t_1 <= 1e+289) {
		tmp = t_1;
	} else {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	}
	return tmp;
}
def code(x, y, z, t):
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y))
def code(x, y, z, t):
	t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)))
	tmp = 0
	if t_1 <= -math.inf:
		tmp = x + ((0.3333333333333333 / z) * (t / y))
	elif t_1 <= 1e+289:
		tmp = t_1
	else:
		tmp = x + ((y - (t / y)) / (z * -3.0))
	return tmp
function code(x, y, z, t)
	return Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(Float64(z * 3.0) * y)))
end
function code(x, y, z, t)
	t_1 = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(t / Float64(y * Float64(z * 3.0))))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(x + Float64(Float64(0.3333333333333333 / z) * Float64(t / y)));
	elseif (t_1 <= 1e+289)
		tmp = t_1;
	else
		tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0)));
	end
	return tmp
end
function tmp = code(x, y, z, t)
	tmp = (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
end
function tmp_2 = code(x, y, z, t)
	t_1 = (x - (y / (z * 3.0))) + (t / (y * (z * 3.0)));
	tmp = 0.0;
	if (t_1 <= -Inf)
		tmp = x + ((0.3333333333333333 / z) * (t / y));
	elseif (t_1 <= 1e+289)
		tmp = t_1;
	else
		tmp = x + ((y - (t / y)) / (z * -3.0));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(x + N[(N[(0.3333333333333333 / z), $MachinePrecision] * N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 1e+289], t$95$1, N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
t_1 := \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \frac{t}{y}\\

\mathbf{elif}\;t_1 \leq 10^{+289}:\\
\;\;\;\;t_1\\

\mathbf{else}:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original67.7%
Target69.9%
Herbie71.3%
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation?

  1. Split input into 3 regimes
  2. if (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < -inf.0

    1. Initial program 0.0%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Simplified17.4%

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
      Step-by-step derivation

      [Start]0.0

      \[ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]

      associate-+l- [=>]0.0

      \[ \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]

      sub-neg [=>]0.0

      \[ \color{blue}{x + \left(-\left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)} \]

      sub-neg [=>]0.0

      \[ x + \left(-\color{blue}{\left(\frac{y}{z \cdot 3} + \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]

      distribute-neg-in [=>]0.0

      \[ x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)\right)} \]

      unsub-neg [=>]0.0

      \[ x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)} \]

      neg-mul-1 [=>]0.0

      \[ x + \left(\color{blue}{-1 \cdot \frac{y}{z \cdot 3}} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      associate-*r/ [=>]0.0

      \[ x + \left(\color{blue}{\frac{-1 \cdot y}{z \cdot 3}} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      associate-*l/ [<=]0.0

      \[ x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      distribute-neg-frac [=>]0.0

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right) \]

      neg-mul-1 [=>]0.0

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \frac{\color{blue}{-1 \cdot t}}{\left(z \cdot 3\right) \cdot y}\right) \]

      times-frac [=>]17.4

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]

      distribute-lft-out-- [=>]17.4

      \[ x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]

      *-commutative [=>]17.4

      \[ x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]

      associate-/r* [=>]17.4

      \[ x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]

      metadata-eval [=>]17.4

      \[ x + \frac{\color{blue}{-0.3333333333333333}}{z} \cdot \left(y - \frac{t}{y}\right) \]
    3. Taylor expanded in y around 0 0.9%

      \[\leadsto x + \color{blue}{0.3333333333333333 \cdot \frac{t}{y \cdot z}} \]
    4. Simplified18.3%

      \[\leadsto x + \color{blue}{\frac{0.3333333333333333}{z} \cdot \frac{t}{y}} \]
      Step-by-step derivation

      [Start]0.9

      \[ x + 0.3333333333333333 \cdot \frac{t}{y \cdot z} \]

      associate-*r/ [=>]0.9

      \[ x + \color{blue}{\frac{0.3333333333333333 \cdot t}{y \cdot z}} \]

      *-commutative [=>]0.9

      \[ x + \frac{0.3333333333333333 \cdot t}{\color{blue}{z \cdot y}} \]

      times-frac [=>]18.3

      \[ x + \color{blue}{\frac{0.3333333333333333}{z} \cdot \frac{t}{y}} \]

    if -inf.0 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y))) < 1.0000000000000001e289

    1. Initial program 99.5%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]

    if 1.0000000000000001e289 < (+.f64 (-.f64 x (/.f64 y (*.f64 z 3))) (/.f64 t (*.f64 (*.f64 z 3) y)))

    1. Initial program 7.1%

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
    2. Simplified18.9%

      \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)} \]
      Step-by-step derivation

      [Start]7.1

      \[ \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]

      associate-+l- [=>]7.1

      \[ \color{blue}{x - \left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)} \]

      sub-neg [=>]7.1

      \[ \color{blue}{x + \left(-\left(\frac{y}{z \cdot 3} - \frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)} \]

      sub-neg [=>]7.1

      \[ x + \left(-\color{blue}{\left(\frac{y}{z \cdot 3} + \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)}\right) \]

      distribute-neg-in [=>]7.1

      \[ x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) + \left(-\left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)\right)} \]

      unsub-neg [=>]7.1

      \[ x + \color{blue}{\left(\left(-\frac{y}{z \cdot 3}\right) - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right)} \]

      neg-mul-1 [=>]7.1

      \[ x + \left(\color{blue}{-1 \cdot \frac{y}{z \cdot 3}} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      associate-*r/ [=>]7.1

      \[ x + \left(\color{blue}{\frac{-1 \cdot y}{z \cdot 3}} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      associate-*l/ [<=]7.1

      \[ x + \left(\color{blue}{\frac{-1}{z \cdot 3} \cdot y} - \left(-\frac{t}{\left(z \cdot 3\right) \cdot y}\right)\right) \]

      distribute-neg-frac [=>]7.1

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-t}{\left(z \cdot 3\right) \cdot y}}\right) \]

      neg-mul-1 [=>]7.1

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \frac{\color{blue}{-1 \cdot t}}{\left(z \cdot 3\right) \cdot y}\right) \]

      times-frac [=>]19.0

      \[ x + \left(\frac{-1}{z \cdot 3} \cdot y - \color{blue}{\frac{-1}{z \cdot 3} \cdot \frac{t}{y}}\right) \]

      distribute-lft-out-- [=>]19.0

      \[ x + \color{blue}{\frac{-1}{z \cdot 3} \cdot \left(y - \frac{t}{y}\right)} \]

      *-commutative [=>]19.0

      \[ x + \frac{-1}{\color{blue}{3 \cdot z}} \cdot \left(y - \frac{t}{y}\right) \]

      associate-/r* [=>]18.9

      \[ x + \color{blue}{\frac{\frac{-1}{3}}{z}} \cdot \left(y - \frac{t}{y}\right) \]

      metadata-eval [=>]18.9

      \[ x + \frac{\color{blue}{-0.3333333333333333}}{z} \cdot \left(y - \frac{t}{y}\right) \]
    3. Applied egg-rr19.0%

      \[\leadsto x + \color{blue}{\frac{y - \frac{t}{y}}{z \cdot -3}} \]
      Step-by-step derivation

      [Start]18.9

      \[ x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right) \]

      *-commutative [=>]18.9

      \[ x + \color{blue}{\left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}} \]

      clear-num [=>]18.9

      \[ x + \left(y - \frac{t}{y}\right) \cdot \color{blue}{\frac{1}{\frac{z}{-0.3333333333333333}}} \]

      un-div-inv [=>]18.9

      \[ x + \color{blue}{\frac{y - \frac{t}{y}}{\frac{z}{-0.3333333333333333}}} \]

      div-inv [=>]19.0

      \[ x + \frac{y - \frac{t}{y}}{\color{blue}{z \cdot \frac{1}{-0.3333333333333333}}} \]

      metadata-eval [=>]19.0

      \[ x + \frac{y - \frac{t}{y}}{z \cdot \color{blue}{-3}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification71.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq -\infty:\\ \;\;\;\;x + \frac{0.3333333333333333}{z} \cdot \frac{t}{y}\\ \mathbf{elif}\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)} \leq 10^{+289}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy69.8%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -1.45 \cdot 10^{-70} \lor \neg \left(y \leq 4.5 \cdot 10^{-166}\right):\\ \;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \end{array} \]
Alternative 2
Accuracy69.9%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{-141} \lor \neg \left(y \leq 1.25 \cdot 10^{-166}\right):\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \end{array} \]
Alternative 3
Accuracy69.9%
Cost960
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]
Alternative 4
Accuracy39.6%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -6 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.16 \cdot 10^{-107}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{elif}\;x \leq 8 \cdot 10^{-41}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy65.1%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -2.3 \cdot 10^{+15} \lor \neg \left(y \leq 3.45 \cdot 10^{-6}\right):\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \end{array} \]
Alternative 6
Accuracy65.0%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -9 \cdot 10^{+15} \lor \neg \left(y \leq 1.1 \cdot 10^{-6}\right):\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \end{array} \]
Alternative 7
Accuracy53.5%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -1.65 \cdot 10^{-140} \lor \neg \left(y \leq 1.35 \cdot 10^{-183}\right):\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \end{array} \]
Alternative 8
Accuracy39.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4 \cdot 10^{-10}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+127}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Accuracy39.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.6 \cdot 10^{-12}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.7 \cdot 10^{+127}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Accuracy30.1%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023157 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

  :herbie-target
  (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))

  (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))