Average Error: 3.6 → 0.5
Time: 10.3s
Precision: binary64
Cost: 1352
\[\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{\frac{y}{z}}{3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\ \mathbf{if}\;t \leq -1 \cdot 10^{+50}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 10^{+40}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 -1e+50)
     t_1
     (if (<= t 1e+40)
       (+ (- x (/ y (* z 3.0))) (* (/ 1.0 z) (/ t (* y 3.0))))
       t_1))))
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 <= -1e+50) {
		tmp = t_1;
	} else if (t <= 1e+40) {
		tmp = (x - (y / (z * 3.0))) + ((1.0 / z) * (t / (y * 3.0)));
	} else {
		tmp = t_1;
	}
	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)) + (t / (y * (z * 3.0d0)))
    if (t <= (-1d+50)) then
        tmp = t_1
    else if (t <= 1d+40) then
        tmp = (x - (y / (z * 3.0d0))) + ((1.0d0 / z) * (t / (y * 3.0d0)))
    else
        tmp = t_1
    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)) + (t / (y * (z * 3.0)));
	double tmp;
	if (t <= -1e+50) {
		tmp = t_1;
	} else if (t <= 1e+40) {
		tmp = (x - (y / (z * 3.0))) + ((1.0 / z) * (t / (y * 3.0)));
	} else {
		tmp = t_1;
	}
	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 <= -1e+50:
		tmp = t_1
	elif t <= 1e+40:
		tmp = (x - (y / (z * 3.0))) + ((1.0 / z) * (t / (y * 3.0)))
	else:
		tmp = t_1
	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(Float64(y / z) / 3.0)) + Float64(t / Float64(y * Float64(z * 3.0))))
	tmp = 0.0
	if (t <= -1e+50)
		tmp = t_1;
	elseif (t <= 1e+40)
		tmp = Float64(Float64(x - Float64(y / Float64(z * 3.0))) + Float64(Float64(1.0 / z) * Float64(t / Float64(y * 3.0))));
	else
		tmp = t_1;
	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 <= -1e+50)
		tmp = t_1;
	elseif (t <= 1e+40)
		tmp = (x - (y / (z * 3.0))) + ((1.0 / z) * (t / (y * 3.0)));
	else
		tmp = t_1;
	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[(N[(y / z), $MachinePrecision] / 3.0), $MachinePrecision]), $MachinePrecision] + N[(t / N[(y * N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1e+50], t$95$1, If[LessEqual[t, 1e+40], N[(N[(x - N[(y / N[(z * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(1.0 / z), $MachinePrecision] * N[(t / N[(y * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\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{\frac{y}{z}}{3}\right) + \frac{t}{y \cdot \left(z \cdot 3\right)}\\
\mathbf{if}\;t \leq -1 \cdot 10^{+50}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;t \leq 10^{+40}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z} \cdot \frac{t}{y \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation

  1. Split input into 2 regimes
  2. if t < -1.0000000000000001e50 or 1.00000000000000003e40 < t

    1. Initial program 0.7

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

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

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

    if -1.0000000000000001e50 < t < 1.00000000000000003e40

    1. Initial program 5.2

      \[\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 - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{1}{z} \cdot \frac{t}{3 \cdot y}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

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

Alternatives

Alternative 1
Error1.1
Cost3016
\[\begin{array}{l} t_1 := \frac{t}{y \cdot \left(z \cdot 3\right)}\\ t_2 := t_1 + \left(x - \frac{y}{z \cdot 3}\right)\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \mathbf{elif}\;t_2 \leq 5 \cdot 10^{+307}:\\ \;\;\;\;\left(x - \frac{\frac{y}{z}}{3}\right) + t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{t}{z}}{y \cdot 3}\\ \end{array} \]
Alternative 2
Error31.5
Cost1112
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ t_2 := \frac{0.3333333333333333}{\frac{z}{\frac{t}{y}}}\\ \mathbf{if}\;x \leq -1.700944334008428 \cdot 10^{+139}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.900465435961299 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -114114809.9549224:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.643254488018632 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.465967062077892 \cdot 10^{-268}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.601823518045407 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error30.9
Cost1112
\[\begin{array}{l} t_1 := \frac{y}{z \cdot -3}\\ t_2 := \frac{\frac{t}{z}}{y \cdot 3}\\ \mathbf{if}\;x \leq -1.700944334008428 \cdot 10^{+139}:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -7.900465435961299 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq -114114809.9549224:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq -4.643254488018632 \cdot 10^{-91}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;x \leq 1.465967062077892 \cdot 10^{-268}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;x \leq 4.601823518045407 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error16.4
Cost976
\[\begin{array}{l} t_1 := \frac{\frac{t}{z}}{y \cdot 3}\\ t_2 := x + \frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{if}\;y \leq -1.75 \cdot 10^{-151}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;y \leq 2.05 \cdot 10^{-251}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.45 \cdot 10^{-176}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 2.5715065827034028 \cdot 10^{-86}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error6.5
Cost840
\[\begin{array}{l} t_1 := x + \frac{y}{z} \cdot -0.3333333333333333\\ \mathbf{if}\;y \leq -3.6503119238479636 \cdot 10^{+64}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;y \leq 1.169853194029898 \cdot 10^{+27}:\\ \;\;\;\;x + \frac{\frac{t \cdot 0.3333333333333333}{z}}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error27.3
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -114114809.9549224:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.601823518045407 \cdot 10^{-26}:\\ \;\;\;\;\frac{y \cdot -0.3333333333333333}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error27.2
Cost584
\[\begin{array}{l} \mathbf{if}\;x \leq -114114809.9549224:\\ \;\;\;\;x\\ \mathbf{elif}\;x \leq 4.601823518045407 \cdot 10^{-26}:\\ \;\;\;\;\frac{y}{z \cdot -3}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error38.1
Cost64
\[x \]

Error

Reproduce

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