?

Average Error: 6.11% → 1.51%
Time: 14.9s
Precision: binary64
Cost: 1480

?

\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+73}:\\ \;\;\;\;t_1 + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \leq 5 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{\frac{y - \frac{t}{y}}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \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
 (let* ((t_1 (- x (/ y (* z 3.0)))))
   (if (<= (* z 3.0) -2e+73)
     (+ t_1 (/ t (* (* z 3.0) y)))
     (if (<= (* z 3.0) 5e+77)
       (+ x (/ (/ (- y (/ t y)) z) -3.0))
       (+ t_1 (/ (/ 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 t_1 = x - (y / (z * 3.0));
	double tmp;
	if ((z * 3.0) <= -2e+73) {
		tmp = t_1 + (t / ((z * 3.0) * y));
	} else if ((z * 3.0) <= 5e+77) {
		tmp = x + (((y - (t / y)) / z) / -3.0);
	} else {
		tmp = t_1 + ((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) :: t_1
    real(8) :: tmp
    t_1 = x - (y / (z * 3.0d0))
    if ((z * 3.0d0) <= (-2d+73)) then
        tmp = t_1 + (t / ((z * 3.0d0) * y))
    else if ((z * 3.0d0) <= 5d+77) then
        tmp = x + (((y - (t / y)) / z) / (-3.0d0))
    else
        tmp = t_1 + ((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 t_1 = x - (y / (z * 3.0));
	double tmp;
	if ((z * 3.0) <= -2e+73) {
		tmp = t_1 + (t / ((z * 3.0) * y));
	} else if ((z * 3.0) <= 5e+77) {
		tmp = x + (((y - (t / y)) / z) / -3.0);
	} else {
		tmp = t_1 + ((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):
	t_1 = x - (y / (z * 3.0))
	tmp = 0
	if (z * 3.0) <= -2e+73:
		tmp = t_1 + (t / ((z * 3.0) * y))
	elif (z * 3.0) <= 5e+77:
		tmp = x + (((y - (t / y)) / z) / -3.0)
	else:
		tmp = t_1 + ((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)
	t_1 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (Float64(z * 3.0) <= -2e+73)
		tmp = Float64(t_1 + Float64(t / Float64(Float64(z * 3.0) * y)));
	elseif (Float64(z * 3.0) <= 5e+77)
		tmp = Float64(x + Float64(Float64(Float64(y - Float64(t / y)) / z) / -3.0));
	else
		tmp = Float64(t_1 + 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)
	t_1 = x - (y / (z * 3.0));
	tmp = 0.0;
	if ((z * 3.0) <= -2e+73)
		tmp = t_1 + (t / ((z * 3.0) * y));
	elseif ((z * 3.0) <= 5e+77)
		tmp = x + (((y - (t / y)) / z) / -3.0);
	else
		tmp = t_1 + ((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_] := Block[{t$95$1 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * 3.0), $MachinePrecision], -2e+73], N[(t$95$1 + N[(t / N[(N[(z * 3.0), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * 3.0), $MachinePrecision], 5e+77], N[(x + N[(N[(N[(y - N[(t / y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision] / -3.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + 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}
t_1 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+73}:\\
\;\;\;\;t_1 + \frac{t}{\left(z \cdot 3\right) \cdot y}\\

\mathbf{elif}\;z \cdot 3 \leq 5 \cdot 10^{+77}:\\
\;\;\;\;x + \frac{\frac{y - \frac{t}{y}}{z}}{-3}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original6.11%
Target2.65%
Herbie1.51%
\[\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 z 3) < -1.99999999999999997e73

    1. Initial program 0.57

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

    if -1.99999999999999997e73 < (*.f64 z 3) < 5.00000000000000004e77

    1. Initial program 11.69

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

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

      [Start]11.69

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

      associate-+l- [=>]11.69

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

      sub-neg [=>]11.69

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

      neg-mul-1 [=>]11.69

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

      distribute-lft-out-- [<=]11.69

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

      associate-*r/ [=>]11.69

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

      associate-*l/ [<=]11.76

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

      associate-*r/ [=>]11.76

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

      times-frac [=>]1.6

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

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

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

      *-commutative [=>]1.6

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

      associate-/r* [=>]1.59

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

      metadata-eval [=>]1.59

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

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

    if 5.00000000000000004e77 < (*.f64 z 3)

    1. Initial program 0.77

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

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

      [Start]0.77

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

      associate-/r* [=>]2.08

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

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

Alternatives

Alternative 1
Error1.17%
Cost1481
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+73} \lor \neg \left(z \cdot 3 \leq 5 \cdot 10^{+77}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y - \frac{t}{y}}{z}}{-3}\\ \end{array} \]
Alternative 2
Error1.5%
Cost1480
\[\begin{array}{l} t_1 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;z \cdot 3 \leq -2 \cdot 10^{+73}:\\ \;\;\;\;t_1 + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \mathbf{elif}\;z \cdot 3 \leq 5 \cdot 10^{+77}:\\ \;\;\;\;x + \frac{\frac{y - \frac{t}{y}}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \frac{\frac{t}{z} \cdot 0.3333333333333333}{y}\\ \end{array} \]
Alternative 3
Error44.76%
Cost1112
\[\begin{array}{l} t_1 := \frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{if}\;x \leq -4 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.26 \cdot 10^{-250}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq -9.6 \cdot 10^{-290}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ \mathbf{elif}\;x \leq 2.5 \cdot 10^{-264}:\\ \;\;\;\;y \cdot \frac{1}{z \cdot -3}\\ \mathbf{elif}\;x \leq 9.5 \cdot 10^{-204}:\\ \;\;\;\;\frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error13.75%
Cost1104
\[\begin{array}{l} t_1 := x + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ t_2 := x - \frac{\frac{y}{3}}{z}\\ \mathbf{if}\;y \leq -100000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.7 \cdot 10^{-259}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 2.2 \cdot 10^{-220}:\\ \;\;\;\;x + \frac{\frac{t}{y} \cdot 0.3333333333333333}{z}\\ \mathbf{elif}\;y \leq 4.5 \cdot 10^{-63}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error13.69%
Cost1104
\[\begin{array}{l} t_1 := x + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ t_2 := x - \frac{\frac{y}{3}}{z}\\ \mathbf{if}\;y \leq -122000000:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -8.5 \cdot 10^{-260}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 10^{-219}:\\ \;\;\;\;x + \frac{\frac{0.3333333333333333}{\frac{y}{t}}}{z}\\ \mathbf{elif}\;y \leq 6.2 \cdot 10^{-62}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Error3.38%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-37} \lor \neg \left(y \leq 1.4 \cdot 10^{-160}\right):\\ \;\;\;\;x + \left(y - \frac{t}{y}\right) \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{z} \cdot 0.3333333333333333}{y}\\ \end{array} \]
Alternative 7
Error3.39%
Cost969
\[\begin{array}{l} \mathbf{if}\;y \leq -2 \cdot 10^{-37} \lor \neg \left(y \leq 1.4 \cdot 10^{-160}\right):\\ \;\;\;\;x + \frac{\frac{y - \frac{t}{y}}{z}}{-3}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{z} \cdot 0.3333333333333333}{y}\\ \end{array} \]
Alternative 8
Error3.36%
Cost968
\[\begin{array}{l} t_1 := y - \frac{t}{y}\\ \mathbf{if}\;y \leq -2 \cdot 10^{-37}:\\ \;\;\;\;x + \frac{t_1}{z \cdot -3}\\ \mathbf{elif}\;y \leq 1.4 \cdot 10^{-160}:\\ \;\;\;\;x + \frac{\frac{t}{z} \cdot 0.3333333333333333}{y}\\ \mathbf{else}:\\ \;\;\;\;x + t_1 \cdot \frac{-0.3333333333333333}{z}\\ \end{array} \]
Alternative 9
Error43.86%
Cost848
\[\begin{array}{l} \mathbf{if}\;x \leq -3.8 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -1.3 \cdot 10^{-255}:\\ \;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{elif}\;x \leq -3.2 \cdot 10^{-291}:\\ \;\;\;\;0.3333333333333333 \cdot \frac{t}{z \cdot y}\\ \mathbf{elif}\;x \leq 9.2 \cdot 10^{+51}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error14.31%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -10600000 \lor \neg \left(y \leq 5.9 \cdot 10^{-62}\right):\\ \;\;\;\;x - \frac{\frac{y}{3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + t \cdot \frac{0.3333333333333333}{z \cdot y}\\ \end{array} \]
Alternative 11
Error13.92%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -28500000 \lor \neg \left(y \leq 2.6 \cdot 10^{-62}\right):\\ \;\;\;\;x - \frac{\frac{y}{3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array} \]
Alternative 12
Error9.83%
Cost841
\[\begin{array}{l} \mathbf{if}\;y \leq -59000000000 \lor \neg \left(y \leq 3.85 \cdot 10^{-62}\right):\\ \;\;\;\;x - \frac{\frac{y}{3}}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{t}{z} \cdot 0.3333333333333333}{y}\\ \end{array} \]
Alternative 13
Error18.42%
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -1 \cdot 10^{-78}:\\ \;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{elif}\;x \leq 2.8 \cdot 10^{-48}:\\ \;\;\;\;\frac{0.3333333333333333}{z} \cdot \left(\frac{t}{y} - y\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{\frac{y}{3}}{z}\\ \end{array} \]
Alternative 14
Error27.34%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -3.2 \cdot 10^{-103} \lor \neg \left(y \leq 7.2 \cdot 10^{-219}\right):\\ \;\;\;\;x + y \cdot \frac{-0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \end{array} \]
Alternative 15
Error27.37%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{-100} \lor \neg \left(y \leq 2.1 \cdot 10^{-216}\right):\\ \;\;\;\;x + -0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \end{array} \]
Alternative 16
Error27.23%
Cost713
\[\begin{array}{l} \mathbf{if}\;y \leq -2.9 \cdot 10^{-103} \lor \neg \left(y \leq 3.2 \cdot 10^{-217}\right):\\ \;\;\;\;x - \frac{\frac{y}{3}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{y} \cdot \frac{0.3333333333333333}{z}\\ \end{array} \]
Alternative 17
Error43.88%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.1 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 1.8 \cdot 10^{+51}:\\ \;\;\;\;-0.3333333333333333 \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 18
Error43.83%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -3 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 2.3 \cdot 10^{+50}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 19
Error43.84%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.9 \cdot 10^{-34}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.5 \cdot 10^{+51}:\\ \;\;\;\;\frac{y}{\frac{z}{-0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 20
Error43.95%
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -1.5 \cdot 10^{-36}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 3.8 \cdot 10^{+49}:\\ \;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 21
Error59.15%
Cost64
\[x \]

Error

Reproduce?

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