Average Error: 3.4 → 0.4
Time: 14.6s
Precision: binary64
Cost: 7688
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y} \]
\[\begin{array}{l} t_1 := \frac{t}{y \cdot \left(z \cdot 3\right)}\\ t_2 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;t \leq -1.8314729472812219 \cdot 10^{+22}:\\ \;\;\;\;t_2 + t_1\\ \mathbf{elif}\;t \leq 10^{+60}:\\ \;\;\;\;t_2 + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(x - {\left(3 \cdot \frac{z}{y}\right)}^{-1}\right)\\ \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 (/ t (* y (* z 3.0)))) (t_2 (- x (/ y (* z 3.0)))))
   (if (<= t -1.8314729472812219e+22)
     (+ t_2 t_1)
     (if (<= t 1e+60)
       (+ t_2 (* (/ 1.0 z) (/ t (* y 3.0))))
       (+ t_1 (- x (pow (* 3.0 (/ z y)) -1.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 = t / (y * (z * 3.0));
	double t_2 = x - (y / (z * 3.0));
	double tmp;
	if (t <= -1.8314729472812219e+22) {
		tmp = t_2 + t_1;
	} else if (t <= 1e+60) {
		tmp = t_2 + ((1.0 / z) * (t / (y * 3.0)));
	} else {
		tmp = t_1 + (x - pow((3.0 * (z / y)), -1.0));
	}
	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) :: t_2
    real(8) :: tmp
    t_1 = t / (y * (z * 3.0d0))
    t_2 = x - (y / (z * 3.0d0))
    if (t <= (-1.8314729472812219d+22)) then
        tmp = t_2 + t_1
    else if (t <= 1d+60) then
        tmp = t_2 + ((1.0d0 / z) * (t / (y * 3.0d0)))
    else
        tmp = t_1 + (x - ((3.0d0 * (z / y)) ** (-1.0d0)))
    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 = t / (y * (z * 3.0));
	double t_2 = x - (y / (z * 3.0));
	double tmp;
	if (t <= -1.8314729472812219e+22) {
		tmp = t_2 + t_1;
	} else if (t <= 1e+60) {
		tmp = t_2 + ((1.0 / z) * (t / (y * 3.0)));
	} else {
		tmp = t_1 + (x - Math.pow((3.0 * (z / y)), -1.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 = t / (y * (z * 3.0))
	t_2 = x - (y / (z * 3.0))
	tmp = 0
	if t <= -1.8314729472812219e+22:
		tmp = t_2 + t_1
	elif t <= 1e+60:
		tmp = t_2 + ((1.0 / z) * (t / (y * 3.0)))
	else:
		tmp = t_1 + (x - math.pow((3.0 * (z / y)), -1.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(t / Float64(y * Float64(z * 3.0)))
	t_2 = Float64(x - Float64(y / Float64(z * 3.0)))
	tmp = 0.0
	if (t <= -1.8314729472812219e+22)
		tmp = Float64(t_2 + t_1);
	elseif (t <= 1e+60)
		tmp = Float64(t_2 + Float64(Float64(1.0 / z) * Float64(t / Float64(y * 3.0))));
	else
		tmp = Float64(t_1 + Float64(x - (Float64(3.0 * Float64(z / y)) ^ -1.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 = t / (y * (z * 3.0));
	t_2 = x - (y / (z * 3.0));
	tmp = 0.0;
	if (t <= -1.8314729472812219e+22)
		tmp = t_2 + t_1;
	elseif (t <= 1e+60)
		tmp = t_2 + ((1.0 / z) * (t / (y * 3.0)));
	else
		tmp = t_1 + (x - ((3.0 * (z / y)) ^ -1.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[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.8314729472812219e+22], N[(t$95$2 + t$95$1), $MachinePrecision], If[LessEqual[t, 1e+60], N[(t$95$2 + N[(N[(1.0 / z), $MachinePrecision] * N[(t / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x - N[Power[N[(3.0 * N[(z / y), $MachinePrecision]), $MachinePrecision], -1.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 := \frac{t}{y \cdot \left(z \cdot 3\right)}\\
t_2 := x - \frac{y}{z \cdot 3}\\
\mathbf{if}\;t \leq -1.8314729472812219 \cdot 10^{+22}:\\
\;\;\;\;t_2 + t_1\\

\mathbf{elif}\;t \leq 10^{+60}:\\
\;\;\;\;t_2 + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\

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


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.4
Target1.6
Herbie0.4
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y} \]

Derivation

  1. Split input into 3 regimes
  2. if t < -1.8314729472812219e22

    1. Initial program 0.4

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

    if -1.8314729472812219e22 < t < 9.9999999999999995e59

    1. Initial program 5.1

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

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

    if 9.9999999999999995e59 < t

    1. Initial program 0.4

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

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

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

Alternatives

Alternative 1
Error0.4
Cost1480
\[\begin{array}{l} t_1 := \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{if}\;z \cdot 3 \leq -5 \cdot 10^{-60}:\\ \;\;\;\;t_1 + \left(x - \frac{\frac{y}{z}}{3}\right)\\ \mathbf{elif}\;z \cdot 3 \leq 2 \cdot 10^{-42}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + t_1\\ \end{array} \]
Alternative 2
Error0.4
Cost1352
\[\begin{array}{l} t_1 := \frac{t}{y \cdot \left(z \cdot 3\right)}\\ t_2 := x - \frac{y}{z \cdot 3}\\ \mathbf{if}\;t \leq -1.8314729472812219 \cdot 10^{+22}:\\ \;\;\;\;t_2 + t_1\\ \mathbf{elif}\;t \leq 10^{+60}:\\ \;\;\;\;t_2 + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;t_1 + \left(x - \frac{\frac{y}{z}}{3}\right)\\ \end{array} \]
Alternative 3
Error29.6
Cost1244
\[\begin{array}{l} t_1 := \frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ t_2 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -7.280088577031702 \cdot 10^{+75}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.3465093818346616 \cdot 10^{+20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -14.777912412747105:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq -2.6214729508004137 \cdot 10^{-34}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-130}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.549257929109093 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error29.6
Cost1244
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -7.280088577031702 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.3465093818346616 \cdot 10^{+20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -14.777912412747105:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.6214729508004137 \cdot 10^{-34}:\\ \;\;\;\;\frac{0.3333333333333333}{y \cdot \frac{z}{t}}\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-130}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{t}{z}}{\frac{y}{0.3333333333333333}}\\ \mathbf{elif}\;y \leq 1.549257929109093 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error29.6
Cost1244
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -7.280088577031702 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.3465093818346616 \cdot 10^{+20}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq -14.777912412747105:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq -2.6214729508004137 \cdot 10^{-34}:\\ \;\;\;\;t \cdot \frac{0.3333333333333333}{y \cdot z}\\ \mathbf{elif}\;y \leq -3.15 \cdot 10^{-130}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{t}{z}}{\frac{y}{0.3333333333333333}}\\ \mathbf{elif}\;y \leq 1.549257929109093 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error0.4
Cost1224
\[\begin{array}{l} t_1 := \frac{t}{y \cdot \left(z \cdot 3\right)} + \left(x - \frac{\frac{y}{z}}{3}\right)\\ \mathbf{if}\;z \leq -1 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 10^{-25}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error0.4
Cost1224
\[\begin{array}{l} \mathbf{if}\;z \leq -1 \cdot 10^{-61}:\\ \;\;\;\;\frac{t}{y \cdot \left(z \cdot 3\right)} + \left(x - \frac{\frac{y}{z}}{3}\right)\\ \mathbf{elif}\;z \leq 10^{-35}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + t \cdot \frac{\frac{0.3333333333333333}{z}}{y}\\ \end{array} \]
Alternative 8
Error9.9
Cost1104
\[\begin{array}{l} t_1 := x + \frac{\frac{t \cdot 0.3333333333333333}{y}}{z}\\ \mathbf{if}\;y \leq -14.777912412747105:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 10^{-200}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-133}:\\ \;\;\;\;\frac{t \cdot 0.3333333333333333}{y \cdot z}\\ \mathbf{elif}\;y \leq 3.4410829740960673 \cdot 10^{-28}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z} \cdot -0.3333333333333333\\ \end{array} \]
Alternative 9
Error10.2
Cost1104
\[\begin{array}{l} t_1 := x + \frac{\frac{t \cdot 0.3333333333333333}{y}}{z}\\ \mathbf{if}\;y \leq -14.777912412747105:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 10^{-200}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3 \cdot 10^{-133}:\\ \;\;\;\;\frac{t \cdot 0.3333333333333333}{y \cdot z}\\ \mathbf{elif}\;y \leq 3.8472076787083203 \cdot 10^{-60}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{\frac{z}{y \cdot 0.3333333333333333}}\\ \end{array} \]
Alternative 10
Error4.2
Cost968
\[\begin{array}{l} t_1 := x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)\\ \mathbf{if}\;y \leq 10^{-273}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 4.987188556751195 \cdot 10^{-28}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error11.8
Cost840
\[\begin{array}{l} \mathbf{if}\;x \leq -2.4395939510347985 \cdot 10^{-114}:\\ \;\;\;\;x + \frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{elif}\;x \leq 6.103813402301225 \cdot 10^{-133}:\\ \;\;\;\;\frac{-0.3333333333333333 \cdot \left(y - \frac{t}{y}\right)}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \end{array} \]
Alternative 12
Error8.2
Cost840
\[\begin{array}{l} \mathbf{if}\;y \leq -14.777912412747105:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 4.987188556751195 \cdot 10^{-28}:\\ \;\;\;\;x + 0.3333333333333333 \cdot \frac{t}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{-1}{\frac{z}{y \cdot 0.3333333333333333}}\\ \end{array} \]
Alternative 13
Error15.4
Cost712
\[\begin{array}{l} t_1 := x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{if}\;y \leq -3.15 \cdot 10^{-130}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{t}{z}}{\frac{y}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 14
Error15.5
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -3.15 \cdot 10^{-130}:\\ \;\;\;\;x + \frac{-0.3333333333333333}{\frac{z}{y}}\\ \mathbf{elif}\;y \leq 3.9 \cdot 10^{-133}:\\ \;\;\;\;\frac{\frac{t}{z}}{\frac{y}{0.3333333333333333}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{z} \cdot -0.3333333333333333\\ \end{array} \]
Alternative 15
Error31.5
Cost584
\[\begin{array}{l} t_1 := \frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{if}\;y \leq -7.280088577031702 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.549257929109093 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 16
Error31.5
Cost584
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ \mathbf{if}\;y \leq -7.280088577031702 \cdot 10^{+75}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.549257929109093 \cdot 10^{+40}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 17
Error37.2
Cost64
\[x \]

Error

Reproduce

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