?

Average Accuracy: 95.7% → 99.7%
Time: 10.1s
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{x}{-z}}{t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+230}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{t}}{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))
   (/ (/ x (- z)) t)
   (if (<= (* z t) 2e+230) (/ x (- y (* z t))) (/ (/ (- x) t) 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 = (x / -z) / t;
	} else if ((z * t) <= 2e+230) {
		tmp = x / (y - (z * t));
	} else {
		tmp = (-x / t) / 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 = (x / -z) / t;
	} else if ((z * t) <= 2e+230) {
		tmp = x / (y - (z * t));
	} else {
		tmp = (-x / t) / 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 = (x / -z) / t
	elif (z * t) <= 2e+230:
		tmp = x / (y - (z * t))
	else:
		tmp = (-x / t) / 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(x / Float64(-z)) / t);
	elseif (Float64(z * t) <= 2e+230)
		tmp = Float64(x / Float64(y - Float64(z * t)));
	else
		tmp = Float64(Float64(Float64(-x) / t) / 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 = (x / -z) / t;
	elseif ((z * t) <= 2e+230)
		tmp = x / (y - (z * t));
	else
		tmp = (-x / t) / 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[(x / (-z)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+230], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x) / t), $MachinePrecision] / z), $MachinePrecision]]]
\frac{x}{y - z \cdot t}
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{\frac{x}{-z}}{t}\\

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

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


\end{array}

Error?

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original95.7%
Target96.7%
Herbie99.7%
\[\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 58.2%

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

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

      [Start]58.2

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

      add-cube-cbrt [=>]58.2

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

      add-sqr-sqrt [=>]58.2

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

      times-frac [=>]58.2

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

      pow2 [=>]58.2

      \[ \frac{\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}}{\sqrt{y - z \cdot t}} \cdot \frac{\sqrt[3]{x}}{\sqrt{y - z \cdot t}} \]
    3. Simplified58.2%

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

      [Start]58.2

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

      associate-*l/ [=>]58.2

      \[ \color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2} \cdot \frac{\sqrt[3]{x}}{\sqrt{y - z \cdot t}}}{\sqrt{y - z \cdot t}}} \]

      associate-*r/ [=>]58.2

      \[ \frac{\color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2} \cdot \sqrt[3]{x}}{\sqrt{y - z \cdot t}}}}{\sqrt{y - z \cdot t}} \]

      unpow2 [=>]58.2

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

      rem-3cbrt-lft [=>]58.2

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

      associate-/l/ [=>]58.2

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

      *-commutative [=>]58.2

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

      *-commutative [=>]58.2

      \[ \frac{x}{\sqrt{y - t \cdot z} \cdot \sqrt{y - \color{blue}{t \cdot z}}} \]
    4. Taylor expanded in y around 0 58.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    5. Simplified99.8%

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

      [Start]58.2

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

      associate-*r/ [=>]58.2

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

      neg-mul-1 [<=]58.2

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

      associate-/r* [=>]99.8

      \[ \color{blue}{\frac{\frac{-x}{t}}{z}} \]
    6. Taylor expanded in x around 0 58.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    7. Simplified99.8%

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

      [Start]58.2

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

      associate-/r* [=>]99.8

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

      metadata-eval [<=]99.8

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

      times-frac [<=]99.8

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

      neg-mul-1 [<=]99.8

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

      associate-*l/ [<=]99.7

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

      associate-*r/ [=>]99.7

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

      associate-*l/ [=>]99.8

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

      *-lft-identity [=>]99.8

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

    if -inf.0 < (*.f64 z t) < 2.0000000000000002e230

    1. Initial program 99.9%

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

    if 2.0000000000000002e230 < (*.f64 z t)

    1. Initial program 72.0%

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

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

      [Start]72.0

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

      add-cube-cbrt [=>]71.5

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

      add-sqr-sqrt [=>]0.0

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

      times-frac [=>]0.0

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

      pow2 [=>]0.0

      \[ \frac{\color{blue}{{\left(\sqrt[3]{x}\right)}^{2}}}{\sqrt{y - z \cdot t}} \cdot \frac{\sqrt[3]{x}}{\sqrt{y - z \cdot t}} \]
    3. Simplified0.0%

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

      [Start]0.0

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

      associate-*l/ [=>]0.0

      \[ \color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2} \cdot \frac{\sqrt[3]{x}}{\sqrt{y - z \cdot t}}}{\sqrt{y - z \cdot t}}} \]

      associate-*r/ [=>]0.0

      \[ \frac{\color{blue}{\frac{{\left(\sqrt[3]{x}\right)}^{2} \cdot \sqrt[3]{x}}{\sqrt{y - z \cdot t}}}}{\sqrt{y - z \cdot t}} \]

      unpow2 [=>]0.0

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

      rem-3cbrt-lft [=>]0.0

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

      associate-/l/ [=>]0.0

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

      *-commutative [=>]0.0

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

      *-commutative [=>]0.0

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

      \[\leadsto \color{blue}{-1 \cdot \frac{x}{t \cdot z}} \]
    5. Simplified99.7%

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

      [Start]72.0

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

      associate-*r/ [=>]72.0

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

      neg-mul-1 [<=]72.0

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

      associate-/r* [=>]99.7

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

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

Alternatives

Alternative 1
Accuracy73.1%
Cost1176
\[\begin{array}{l} t_1 := \frac{\frac{x}{-z}}{t}\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+152}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.2 \cdot 10^{+138}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq -4.5 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -1.22 \cdot 10^{+57}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq -4 \cdot 10^{+23}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;z \leq 2.4 \cdot 10^{-140}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy73.4%
Cost1176
\[\begin{array}{l} t_1 := \frac{\frac{x}{-z}}{t}\\ \mathbf{if}\;z \leq -3.2 \cdot 10^{+152}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2 \cdot 10^{+138}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq -1.15 \cdot 10^{+87}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.4 \cdot 10^{+57}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;z \leq -3.8 \cdot 10^{+23}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{elif}\;z \leq 2.25 \cdot 10^{-91}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-x}{t}}{z}\\ \end{array} \]
Alternative 3
Accuracy70.8%
Cost913
\[\begin{array}{l} \mathbf{if}\;y \leq -1.4 \cdot 10^{+29}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{elif}\;y \leq -9.6 \cdot 10^{-43} \lor \neg \left(y \leq -1.85 \cdot 10^{-142}\right) \land y \leq 5 \cdot 10^{-67}:\\ \;\;\;\;\frac{-x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 4
Accuracy58.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+37} \lor \neg \left(t \leq 8.5 \cdot 10^{+169}\right):\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y}\\ \end{array} \]
Alternative 5
Accuracy58.6%
Cost584
\[\begin{array}{l} \mathbf{if}\;t \leq -1.5 \cdot 10^{+37}:\\ \;\;\;\;\frac{x}{z \cdot t}\\ \mathbf{elif}\;t \leq 1.15 \cdot 10^{+171}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{z}\\ \end{array} \]
Alternative 6
Accuracy54.0%
Cost192
\[\frac{x}{y} \]

Error

Reproduce?

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