?

Average Error: 3.0 → 0.1
Time: 1.8min
Precision: binary64
Cost: 1160

?

\[\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^{+288}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\frac{x}{z} \cdot -3}{t \cdot -3}\\ \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+288)
     (/ x (- y (* z t)))
     (- (/ (* (/ x z) -3.0) (* t -3.0))))))
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+288) {
		tmp = x / (y - (z * t));
	} else {
		tmp = -(((x / z) * -3.0) / (t * -3.0));
	}
	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+288) {
		tmp = x / (y - (z * t));
	} else {
		tmp = -(((x / z) * -3.0) / (t * -3.0));
	}
	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+288:
		tmp = x / (y - (z * t))
	else:
		tmp = -(((x / z) * -3.0) / (t * -3.0))
	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(Float64(x / z) / t));
	elseif (Float64(z * t) <= 2e+288)
		tmp = Float64(x / Float64(y - Float64(z * t)));
	else
		tmp = Float64(-Float64(Float64(Float64(x / z) * -3.0) / Float64(t * -3.0)));
	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+288)
		tmp = x / (y - (z * t));
	else
		tmp = -(((x / z) * -3.0) / (t * -3.0));
	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+288], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[(N[(x / z), $MachinePrecision] * -3.0), $MachinePrecision] / N[(t * -3.0), $MachinePrecision]), $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^{+288}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.0
Target1.6
Herbie0.1
\[\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 22.0

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

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{x}{y - z \cdot t}\right)}^{3}}} \]
    3. Taylor expanded in z around inf 26.0

      \[\leadsto \color{blue}{\frac{\sqrt[3]{-1} \cdot {\left(\frac{{x}^{2} \cdot x}{t \cdot {t}^{2}}\right)}^{0.3333333333333333}}{z}} \]
    4. Simplified19.0

      \[\leadsto \color{blue}{-\frac{\frac{x}{\sqrt[3]{{t}^{3}}}}{z}} \]
      Proof
    5. Applied egg-rr0.1

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

    if -inf.0 < (*.f64 z t) < 2e288

    1. Initial program 0.1

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

    if 2e288 < (*.f64 z t)

    1. Initial program 20.1

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

      \[\leadsto \color{blue}{\sqrt[3]{{\left(\frac{x}{y - z \cdot t}\right)}^{3}}} \]
    3. Taylor expanded in z around inf 27.0

      \[\leadsto \color{blue}{\frac{\sqrt[3]{-1} \cdot {\left(\frac{{x}^{2} \cdot x}{t \cdot {t}^{2}}\right)}^{0.3333333333333333}}{z}} \]
    4. Simplified19.2

      \[\leadsto \color{blue}{-\frac{\frac{x}{\sqrt[3]{{t}^{3}}}}{z}} \]
      Proof
    5. Applied egg-rr18.1

      \[\leadsto -\color{blue}{\left(-x\right) \cdot \frac{\frac{-1}{t}}{z}} \]
    6. Applied egg-rr0.2

      \[\leadsto -\color{blue}{\frac{0 + 3 \cdot \left(x \cdot {z}^{-1}\right)}{3 \cdot t}} \]
    7. Simplified0.2

      \[\leadsto -\color{blue}{\frac{\frac{x}{z} \cdot -3}{t \cdot -3}} \]
      Proof
  3. Recombined 3 regimes into one program.

Alternatives

Alternative 1
Error0.1
Cost968
\[\begin{array}{l} \mathbf{if}\;z \cdot t \leq -\infty:\\ \;\;\;\;-\frac{\frac{x}{z}}{t}\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+288}:\\ \;\;\;\;\frac{x}{y - z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;-\frac{\frac{x}{t}}{z}\\ \end{array} \]
Alternative 2
Error14.4
Cost904
\[\begin{array}{l} t_1 := -\frac{\frac{x}{t}}{z}\\ \mathbf{if}\;z \cdot t \leq -2 \cdot 10^{-61}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+87}:\\ \;\;\;\;\frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error30.0
Cost192
\[\frac{x}{y} \]

Error

Reproduce?

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