?

Average Accuracy: 95.6% → 97.6%
Time: 17.3s
Precision: binary64
Cost: 1220

?

\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \leq 0.00018:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\\ \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
 (if (<= (* z 3.0) 0.00018)
   (+ x (/ (- y (/ t y)) (* z -3.0)))
   (+ (- x (/ y (* z 3.0))) (/ (/ t (* z 3.0)) y))))
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 tmp;
	if ((z * 3.0) <= 0.00018) {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	} else {
		tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
	}
	return tmp;
}
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (x - (y / (z * 3.0d0))) + (t / ((z * 3.0d0) * y))
end function
real(8) function code(x, y, z, t)
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    real(8) :: tmp
    if ((z * 3.0d0) <= 0.00018d0) then
        tmp = x + ((y - (t / y)) / (z * (-3.0d0)))
    else
        tmp = (x - (y / (z * 3.0d0))) + ((t / (z * 3.0d0)) / y)
    end if
    code = tmp
end function
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 tmp;
	if ((z * 3.0) <= 0.00018) {
		tmp = x + ((y - (t / y)) / (z * -3.0));
	} else {
		tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
	}
	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):
	tmp = 0
	if (z * 3.0) <= 0.00018:
		tmp = x + ((y - (t / y)) / (z * -3.0))
	else:
		tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y)
	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)
	tmp = 0.0
	if (Float64(z * 3.0) <= 0.00018)
		tmp = Float64(x + Float64(Float64(y - Float64(t / y)) / Float64(z * -3.0)));
	else
		tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(t / Float64(z * 3.0)) / y));
	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)
	tmp = 0.0;
	if ((z * 3.0) <= 0.00018)
		tmp = x + ((y - (t / y)) / (z * -3.0));
	else
		tmp = (x - (y / (z * 3.0))) + ((t / (z * 3.0)) / y);
	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_] := If[LessEqual[N[(z * 3.0), $MachinePrecision], 0.00018], N[(x + N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / N[(z * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t / N[(z * 3.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \leq 0.00018:\\
\;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\

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


\end{array}

Error?

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original95.6%
Target96.1%
Herbie97.6%
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 z 3) < 1.80000000000000011e-4

    1. Initial program 95.1%

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

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

      [Start]95.1

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

      associate-+l- [=>]95.1

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

      sub-neg [=>]95.1

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

      sub-neg [=>]95.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 [=>]95.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 [=>]95.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 [=>]95.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/ [=>]95.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/ [<=]95.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 [=>]95.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 [=>]95.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 [=>]98.2

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

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

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

      *-commutative [=>]98.7

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

      associate-/r* [=>]98.7

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

      metadata-eval [=>]98.7

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

      \[\leadsto x + \color{blue}{\frac{y - \frac{t}{y}}{z \cdot -3}} \]
      Proof

      [Start]98.7

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

      *-commutative [=>]98.7

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

      clear-num [=>]98.7

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

      un-div-inv [=>]98.7

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

      div-inv [=>]98.8

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

      metadata-eval [=>]98.8

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

    if 1.80000000000000011e-4 < (*.f64 z 3)

    1. Initial program 98.6%

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

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

      [Start]98.6

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

      associate-/r* [=>]99.8

      \[ \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification99.1%

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

Alternatives

Alternative 1
Accuracy97.9%
Cost1220
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \leq 2 \cdot 10^{-8}:\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array} \]
Alternative 2
Accuracy60.7%
Cost1108
\[\begin{array}{l} t_1 := 0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ t_2 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -8 \cdot 10^{+81}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{+26}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -2.35 \cdot 10^{-7}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -4 \cdot 10^{-77}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 3
Accuracy60.7%
Cost1108
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -2.8 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.3 \cdot 10^{+25}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.12 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{y}}{z}\\ \mathbf{elif}\;y \leq -8 \cdot 10^{-76}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-38}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Accuracy62.4%
Cost1108
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -3 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.5 \cdot 10^{+27}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -1.9 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{y}}{z}\\ \mathbf{elif}\;y \leq -2.4 \cdot 10^{-80}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-38}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Accuracy76.9%
Cost977
\[\begin{array}{l} t_1 := x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -2.3 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{y}}{z}\\ \mathbf{elif}\;y \leq -9.8 \cdot 10^{-77} \lor \neg \left(y \leq 2.75 \cdot 10^{-64}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{z}}{y}\\ \end{array} \]
Alternative 6
Accuracy77.1%
Cost977
\[\begin{array}{l} t_1 := x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -2.3 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.05 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{\frac{t}{y}}{z}\\ \mathbf{elif}\;y \leq -4.25 \cdot 10^{-72} \lor \neg \left(y \leq 2.55 \cdot 10^{-64}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}\\ \end{array} \]
Alternative 7
Accuracy77.0%
Cost977
\[\begin{array}{l} t_1 := x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -2.3 \cdot 10^{+25}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-7}:\\ \;\;\;\;0.3333333333333333 \cdot \left(\frac{1}{y} \cdot \frac{t}{z}\right)\\ \mathbf{elif}\;y \leq -5.2 \cdot 10^{-78} \lor \neg \left(y \leq 7.4 \cdot 10^{-65}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{\frac{y}{\frac{t}{z}}}\\ \end{array} \]
Alternative 8
Accuracy88.6%
Cost972
\[\begin{array}{l} t_1 := x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{if}\;y \leq -6 \cdot 10^{+26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 7 \cdot 10^{-305}:\\ \;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-38}:\\ \;\;\;\;x + \frac{t \cdot 0.3333333333333333}{z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy96.0%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq 6 \cdot 10^{-304} \lor \neg \left(y \leq 7.5 \cdot 10^{-102}\right):\\ \;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t \cdot 0.3333333333333333}{z \cdot y}\\ \end{array} \]
Alternative 10
Accuracy96.1%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq 4.5 \cdot 10^{-305} \lor \neg \left(y \leq 6.7 \cdot 10^{-102}\right):\\ \;\;\;\;x + \frac{y - \frac{t}{y}}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t \cdot 0.3333333333333333}{z \cdot y}\\ \end{array} \]
Alternative 11
Accuracy80.9%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -1.3 \cdot 10^{+26} \lor \neg \left(z \leq 1.25 \cdot 10^{+92}\right):\\ \;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\ \end{array} \]
Alternative 12
Accuracy88.4%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -7.2 \cdot 10^{+27} \lor \neg \left(y \leq 2.2 \cdot 10^{-38}\right):\\ \;\;\;\;x - 0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \end{array} \]
Alternative 13
Accuracy48.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -6.4 \cdot 10^{+81} \lor \neg \left(y \leq 1.05 \cdot 10^{+74}\right):\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 14
Accuracy48.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -7.6 \cdot 10^{+81} \lor \neg \left(y \leq 1.02 \cdot 10^{+74}\right):\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 15
Accuracy48.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{+81}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{elif}\;y \leq 1.7 \cdot 10^{+71}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{-0.3333333333333333}{z}\\ \end{array} \]
Alternative 16
Accuracy48.1%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -7.4 \cdot 10^{+80}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{elif}\;y \leq 3.6 \cdot 10^{+72}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{z}{-0.3333333333333333}}\\ \end{array} \]
Alternative 17
Accuracy30.1%
Cost64
\[x \]

Error

Reproduce?

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