?

Average Accuracy: 95.5% → 99.8%
Time: 11.3s
Precision: binary64
Cost: 968

?

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{-1}{\frac{t}{x}}}{z}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original95.5%
Target97.3%
Herbie99.8%
\[\begin{array}{l} \mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\ \end{array} \]

Derivation?

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

    1. Initial program 66.4%

      \[\frac{x}{y - z \cdot t} \]
    2. Applied egg-rr66.4%

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

      [Start]66.4

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

      div-inv [=>]66.4

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

      *-commutative [=>]66.4

      \[ \color{blue}{\frac{1}{y - z \cdot t} \cdot x} \]
    3. Taylor expanded in y around 0 66.4%

      \[\leadsto \color{blue}{\frac{-1}{t \cdot z}} \cdot x \]
    4. Simplified69.6%

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

      [Start]66.4

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

      associate-/r* [=>]69.6

      \[ \color{blue}{\frac{\frac{-1}{t}}{z}} \cdot x \]
    5. Applied egg-rr99.8%

      \[\leadsto \color{blue}{\frac{\frac{-1}{t}}{\frac{z}{x}}} \]
      Proof

      [Start]69.6

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

      associate-/r/ [<=]99.8

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

    if -inf.0 < (*.f64 z t) < 9.9999999999999996e274

    1. Initial program 99.8%

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

    if 9.9999999999999996e274 < (*.f64 z t)

    1. Initial program 72.7%

      \[\frac{x}{y - z \cdot t} \]
    2. Applied egg-rr72.7%

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

      [Start]72.7

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

      div-inv [=>]72.7

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

      *-commutative [=>]72.7

      \[ \color{blue}{\frac{1}{y - z \cdot t} \cdot x} \]
    3. Taylor expanded in y around 0 72.0%

      \[\leadsto \color{blue}{\frac{-1}{t \cdot z}} \cdot x \]
    4. Applied egg-rr99.0%

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

      [Start]72.0

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

      associate-/r* [=>]74.9

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

      associate-*l/ [=>]99.0

      \[ \color{blue}{\frac{\frac{-1}{t} \cdot x}{z}} \]
    5. Applied egg-rr99.0%

      \[\leadsto \frac{\color{blue}{\frac{-1}{\frac{t}{x}}}}{z} \]
      Proof

      [Start]99.0

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

      associate-/r/ [<=]99.0

      \[ \frac{\color{blue}{\frac{-1}{\frac{t}{x}}}}{z} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.8%

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

Alternatives

Alternative 1
Accuracy99.5%
Cost968
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+223}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \mathbf{elif}\;z \cdot t \leq 10^{+275}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \end{array} \]
Alternative 2
Accuracy99.8%
Cost968
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;\frac{\frac{-1}{t}}{\frac{z}{x}}\\ \mathbf{elif}\;z \cdot t \leq 10^{+275}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \end{array} \]
Alternative 3
Accuracy71.4%
Cost913
\[\begin{array}{l} \mathbf{if}\;y \leq -1.9 \cdot 10^{-16}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq 3.2 \cdot 10^{-110} \lor \neg \left(y \leq 230000000\right) \land y \leq 3.5 \cdot 10^{+50}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 4
Accuracy72.9%
Cost712
\[\begin{array}{l} \mathbf{if}\;t \leq -1.8 \cdot 10^{-62}:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \mathbf{elif}\;t \leq 1.2 \cdot 10^{+87}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{z} \cdot \frac{x}{t}\\ \end{array} \]
Alternative 5
Accuracy72.9%
Cost649
\[\begin{array}{l} \mathbf{if}\;t \leq -2.4 \cdot 10^{-62} \lor \neg \left(t \leq 6.2 \cdot 10^{+86}\right):\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 6
Accuracy57.2%
Cost585
\[\begin{array}{l} \mathbf{if}\;t \leq -50000000 \lor \neg \left(t \leq 1.1 \cdot 10^{+193}\right):\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 7
Accuracy57.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -50000000:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{+174}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{z}\\ \end{array} \]
Alternative 8
Accuracy52.6%
Cost192
\[\frac{x}{y} \]

Error

Reproduce?

herbie shell --seed 2023135 
(FPCore (x y z t)
  :name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
  :precision binary64

  :herbie-target
  (if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))

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