?

Average Error: 11.9 → 4.7
Time: 23.8s
Precision: binary64
Cost: 2056

?

\[\frac{x \cdot \left(y - z\right)}{t - z} \]
\[\begin{array}{l} t_1 := x \cdot \left(1 + \left(-\frac{y - t}{z}\right)\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 5 \cdot 10^{+301}:\\ \;\;\;\;\frac{y \cdot x + z \cdot \left(-x\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 (+ 1.0 (- (/ (- y t) z))))) (t_2 (/ (* x (- y z)) (- t z))))
   (if (<= t_2 (- INFINITY))
     t_1
     (if (<= t_2 5e+301) (/ (+ (* y x) (* z (- x))) (- t z)) t_1))))
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 * (1.0 + -((y - t) / z));
	double t_2 = (x * (y - z)) / (t - z);
	double tmp;
	if (t_2 <= -((double) INFINITY)) {
		tmp = t_1;
	} else if (t_2 <= 5e+301) {
		tmp = ((y * x) + (z * -x)) / (t - z);
	} else {
		tmp = t_1;
	}
	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 * (1.0 + -((y - t) / z));
	double t_2 = (x * (y - z)) / (t - z);
	double tmp;
	if (t_2 <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if (t_2 <= 5e+301) {
		tmp = ((y * x) + (z * -x)) / (t - z);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	return (x * (y - z)) / (t - z)
def code(x, y, z, t):
	t_1 = x * (1.0 + -((y - t) / z))
	t_2 = (x * (y - z)) / (t - z)
	tmp = 0
	if t_2 <= -math.inf:
		tmp = t_1
	elif t_2 <= 5e+301:
		tmp = ((y * x) + (z * -x)) / (t - z)
	else:
		tmp = t_1
	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(x * Float64(1.0 + Float64(-Float64(Float64(y - t) / z))))
	t_2 = Float64(Float64(x * Float64(y - z)) / Float64(t - z))
	tmp = 0.0
	if (t_2 <= Float64(-Inf))
		tmp = t_1;
	elseif (t_2 <= 5e+301)
		tmp = Float64(Float64(Float64(y * x) + Float64(z * Float64(-x))) / Float64(t - z));
	else
		tmp = t_1;
	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 * (1.0 + -((y - t) / z));
	t_2 = (x * (y - z)) / (t - z);
	tmp = 0.0;
	if (t_2 <= -Inf)
		tmp = t_1;
	elseif (t_2 <= 5e+301)
		tmp = ((y * x) + (z * -x)) / (t - z);
	else
		tmp = t_1;
	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[(x * N[(1.0 + (-N[(N[(y - t), $MachinePrecision] / z), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 5e+301], N[(N[(N[(y * x), $MachinePrecision] + N[(z * (-x)), $MachinePrecision]), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\frac{x \cdot \left(y - z\right)}{t - z}
\begin{array}{l}
t_1 := x \cdot \left(1 + \left(-\frac{y - t}{z}\right)\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 5 \cdot 10^{+301}:\\
\;\;\;\;\frac{y \cdot x + z \cdot \left(-x\right)}{t - z}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

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

Derivation?

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

    1. Initial program 63.5

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

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

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

      [Start]39.7

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

      rational.json-simplify-1 [=>]39.7

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

      rational.json-simplify-2 [=>]39.7

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

      rational.json-simplify-9 [=>]39.7

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

      rational.json-simplify-2 [=>]39.7

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

      rational.json-simplify-48 [=>]39.7

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

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

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

      [Start]20.7

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

      rational.json-simplify-2 [=>]20.7

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

      rational.json-simplify-2 [=>]20.7

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

      rational.json-simplify-9 [=>]20.7

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

    if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) (-.f64 t z)) < 5.0000000000000004e301

    1. Initial program 1.4

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

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

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

      [Start]1.4

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

      rational.json-simplify-43 [=>]1.4

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

      rational.json-simplify-9 [=>]1.4

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

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

Alternatives

Alternative 1
Error4.7
Cost1928
\[\begin{array}{l} t_1 := x \cdot \left(1 + \left(-\frac{y - t}{z}\right)\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 5 \cdot 10^{+301}:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Error5.7
Cost1864
\[\begin{array}{l} t_1 := \frac{x \cdot \left(y - z\right)}{t - z}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;x\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+301}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error26.5
Cost1044
\[\begin{array}{l} t_1 := \frac{z \cdot \left(-x\right)}{t}\\ \mathbf{if}\;z \leq -1.2 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.5 \cdot 10^{-92}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{elif}\;z \leq 4.2 \cdot 10^{+23}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.15 \cdot 10^{+75}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5 \cdot 10^{+108}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error26.4
Cost1044
\[\begin{array}{l} t_1 := \frac{z \cdot \left(-x\right)}{t}\\ \mathbf{if}\;z \leq -1.05 \cdot 10^{-32}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.28 \cdot 10^{-85}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{elif}\;z \leq 1.3 \cdot 10^{+24}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+76}:\\ \;\;\;\;\frac{t \cdot x}{z} + x\\ \mathbf{elif}\;z \leq 1.05 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error23.9
Cost1044
\[\begin{array}{l} t_1 := \frac{z \cdot \left(-x\right)}{t}\\ t_2 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -1.9 \cdot 10^{-33}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-85}:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{elif}\;z \leq 0.00032:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 1.02 \cdot 10^{+103}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 6
Error20.5
Cost976
\[\begin{array}{l} t_1 := \frac{\left(y - z\right) \cdot x}{t}\\ t_2 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+45}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 6.1 \cdot 10^{+38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 7.6 \cdot 10^{+76}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;z \leq 2.3 \cdot 10^{+122}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 7
Error20.5
Cost912
\[\begin{array}{l} t_1 := x - \frac{y \cdot x}{z}\\ \mathbf{if}\;z \leq -3.7 \cdot 10^{-35}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 0.00032:\\ \;\;\;\;\frac{y \cdot x}{t - z}\\ \mathbf{elif}\;z \leq 7.5 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 1.9 \cdot 10^{+106}:\\ \;\;\;\;\frac{z \cdot \left(-x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 8
Error19.9
Cost908
\[\begin{array}{l} \mathbf{if}\;z \leq -5.2 \cdot 10^{+48}:\\ \;\;\;\;x - \frac{y \cdot x}{z}\\ \mathbf{elif}\;z \leq 3.1 \cdot 10^{-38}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{t}\\ \mathbf{elif}\;z \leq 1.35 \cdot 10^{+216}:\\ \;\;\;\;\frac{z \cdot \left(-x\right)}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 9
Error25.9
Cost584
\[\begin{array}{l} \mathbf{if}\;z \leq -1.2 \cdot 10^{-31}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 0.00062:\\ \;\;\;\;\frac{y \cdot x}{t}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 10
Error39.6
Cost64
\[x \]

Error

Reproduce?

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