?

Average Error: 11.6 → 4.5
Time: 9.1s
Precision: binary64
Cost: 1992

?

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

\mathbf{elif}\;t_1 \leq 2 \cdot 10^{+246}:\\
\;\;\;\;\frac{x \cdot y - x \cdot z}{t - z}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.6
Target2.2
Herbie4.5
\[\frac{x}{\frac{t - z}{y - z}} \]

Derivation?

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

    1. Initial program 64.0

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Taylor expanded in z around -inf 38.9

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x - t \cdot x}{z} + x} \]
    3. Simplified38.9

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

      [Start]38.9

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]38.9

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]38.9

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]38.9

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]38.9

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

      rational_best_oopsla_all_46_json_45_simplify-102 [=>]38.9

      \[ x + \left(-\frac{\color{blue}{x \cdot \left(y - t\right)}}{z}\right) \]
    4. Taylor expanded in x around -inf 17.5

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

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

      [Start]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-37 [=>]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-74 [<=]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-52 [=>]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]17.5

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]17.5

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

    if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 2.00000000000000014e246

    1. Initial program 1.2

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

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

    if 2.00000000000000014e246 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z))

    1. Initial program 55.1

      \[\frac{x \cdot \left(y - z\right)}{t - z} \]
    2. Taylor expanded in z around -inf 37.4

      \[\leadsto \color{blue}{-1 \cdot \frac{y \cdot x - t \cdot x}{z} + x} \]
    3. Simplified37.4

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

      [Start]37.4

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

      rational_best_oopsla_all_46_json_45_simplify-35 [=>]37.4

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]37.4

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]37.4

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]37.4

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

      rational_best_oopsla_all_46_json_45_simplify-102 [=>]37.4

      \[ x + \left(-\frac{\color{blue}{x \cdot \left(y - t\right)}}{z}\right) \]
    4. Taylor expanded in x around -inf 21.2

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

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

      [Start]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-37 [=>]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-74 [<=]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-52 [=>]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-74 [=>]21.2

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

      rational_best_oopsla_all_46_json_45_simplify-92 [=>]21.2

      \[ x + x \cdot \color{blue}{\left(-\frac{y - t}{z}\right)} \]
    6. Taylor expanded in y around inf 21.2

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

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

Alternatives

Alternative 1
Error4.5
Cost1864
\[\begin{array}{l} t_1 := x + x \cdot \left(-\frac{y}{z}\right)\\ t_2 := \frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{if}\;t_2 \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_2 \leq 2 \cdot 10^{+246}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error4.5
Cost1864
\[\begin{array}{l} t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x + x \cdot \left(-\frac{y - t}{z}\right)\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+246}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x + x \cdot \left(-\frac{y}{z}\right)\\ \end{array} \]
Alternative 3
Error21.0
Cost1436
\[\begin{array}{l} t_1 := \frac{z \cdot \left(-x\right)}{t - z}\\ t_2 := \frac{\left(y - z\right) \cdot x}{t}\\ \mathbf{if}\;t \leq -2.6 \cdot 10^{+227}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1.8 \cdot 10^{+71}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -4.4 \cdot 10^{+35}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq -1 \cdot 10^{-19}:\\ \;\;\;\;x - \frac{y \cdot x}{z}\\ \mathbf{elif}\;t \leq -6.6 \cdot 10^{-31}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq -8.2 \cdot 10^{-56}:\\ \;\;\;\;\frac{y \cdot x}{t - z}\\ \mathbf{elif}\;t \leq 6.2 \cdot 10^{+44}:\\ \;\;\;\;x + x \cdot \left(-\frac{y}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 4
Error25.7
Cost844
\[\begin{array}{l} t_1 := \left(1 + \frac{t}{z}\right) \cdot x\\ \mathbf{if}\;z \leq -1.82 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -3.9 \cdot 10^{-97}:\\ \;\;\;\;\frac{z \cdot \left(-x\right)}{t}\\ \mathbf{elif}\;z \leq 6.9 \cdot 10^{-12}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error17.0
Cost776
\[\begin{array}{l} t_1 := x + x \cdot \left(-\frac{y}{z}\right)\\ \mathbf{if}\;z \leq -2.9 \cdot 10^{-24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 2.6 \cdot 10^{-11}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error25.6
Cost716
\[\begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+39}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq -3.4 \cdot 10^{-97}:\\ \;\;\;\;\frac{z \cdot \left(-x\right)}{t}\\ \mathbf{elif}\;z \leq 4.4 \cdot 10^{-14}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error22.2
Cost712
\[\begin{array}{l} t_1 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -1.35 \cdot 10^{-95}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.8 \cdot 10^{-14}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 8
Error19.0
Cost712
\[\begin{array}{l} t_1 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -5.8 \cdot 10^{+39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4 \cdot 10^{-14}:\\ \;\;\;\;\frac{y \cdot x}{t - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Error19.4
Cost712
\[\begin{array}{l} t_1 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -2 \cdot 10^{-26}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{-13}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 10
Error25.4
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -6.2 \cdot 10^{-24}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 10^{-13}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 11
Error39.6
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023090 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderAreaSpots4D from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (/ x (/ (- t z) (- y z)))

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