?

Average Accuracy: 88.3% → 98.8%
Time: 14.5s
Precision: binary64
Cost: 1609

?

\[ \begin{array}{c}[y, t] = \mathsf{sort}([y, t])\\ \end{array} \]
\[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
\[\begin{array}{l} t_1 := \left(y - z\right) \cdot \left(t - z\right)\\ \mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+273}\right):\\ \;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{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 (* (- y z) (- t z))))
   (if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+273)))
     (/ (/ x (- z t)) (- z y))
     (/ x 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 = (y - z) * (t - z);
	double tmp;
	if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+273)) {
		tmp = (x / (z - t)) / (z - y);
	} else {
		tmp = x / 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 = (y - z) * (t - z);
	double tmp;
	if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+273)) {
		tmp = (x / (z - t)) / (z - y);
	} else {
		tmp = x / t_1;
	}
	return tmp;
}
def code(x, y, z, t):
	return x / ((y - z) * (t - z))
def code(x, y, z, t):
	t_1 = (y - z) * (t - z)
	tmp = 0
	if (t_1 <= -math.inf) or not (t_1 <= 5e+273):
		tmp = (x / (z - t)) / (z - y)
	else:
		tmp = x / t_1
	return tmp
function code(x, y, z, t)
	return Float64(x / Float64(Float64(y - z) * Float64(t - z)))
end
function code(x, y, z, t)
	t_1 = Float64(Float64(y - z) * Float64(t - z))
	tmp = 0.0
	if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+273))
		tmp = Float64(Float64(x / Float64(z - t)) / Float64(z - y));
	else
		tmp = Float64(x / 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 = (y - z) * (t - z);
	tmp = 0.0;
	if ((t_1 <= -Inf) || ~((t_1 <= 5e+273)))
		tmp = (x / (z - t)) / (z - y);
	else
		tmp = x / t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_, t_] := N[(x / N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y - z), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+273]], $MachinePrecision]], N[(N[(x / N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(z - y), $MachinePrecision]), $MachinePrecision], N[(x / t$95$1), $MachinePrecision]]]
\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}
\begin{array}{l}
t_1 := \left(y - z\right) \cdot \left(t - z\right)\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+273}\right):\\
\;\;\;\;\frac{\frac{x}{z - t}}{z - y}\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original88.3%
Target87.4%
Herbie98.8%
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} < 0:\\ \;\;\;\;\frac{\frac{x}{y - z}}{t - z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 (-.f64 y z) (-.f64 t z)) < -inf.0 or 4.99999999999999961e273 < (*.f64 (-.f64 y z) (-.f64 t z))

    1. Initial program 75.8%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
    2. Simplified99.9%

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

      [Start]75.8

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

      sub-neg [=>]75.8

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

      +-commutative [=>]75.8

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

      neg-sub0 [=>]75.8

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

      associate-+l- [=>]75.8

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

      sub0-neg [=>]75.8

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

      distribute-lft-neg-out [=>]75.8

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

      distribute-rgt-neg-in [=>]75.8

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

      neg-sub0 [=>]75.8

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

      associate-+l- [<=]75.8

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

      neg-sub0 [<=]75.8

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

      +-commutative [<=]75.8

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

      sub-neg [<=]75.8

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

      associate-/l/ [<=]99.9

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

    if -inf.0 < (*.f64 (-.f64 y z) (-.f64 t z)) < 4.99999999999999961e273

    1. Initial program 98.0%

      \[\frac{x}{\left(y - z\right) \cdot \left(t - z\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification98.8%

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

Alternatives

Alternative 1
Accuracy80.5%
Cost1108
\[\begin{array}{l} t_1 := \frac{\frac{x}{z - y}}{z}\\ t_2 := \frac{\frac{x}{t}}{y - z}\\ \mathbf{if}\;t \leq -8.8 \cdot 10^{-30}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 5.2 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.02 \cdot 10^{-50}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t \leq 3.6 \cdot 10^{-13}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 8.8 \cdot 10^{+58}:\\ \;\;\;\;\frac{\frac{x}{z - t}}{z}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 2
Accuracy76.3%
Cost977
\[\begin{array}{l} \mathbf{if}\;t \leq -1.08 \cdot 10^{-71}:\\ \;\;\;\;\frac{\frac{x}{y}}{t}\\ \mathbf{elif}\;t \leq 1.4 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;t \leq 1.05 \cdot 10^{-7} \lor \neg \left(t \leq 7.2 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\ \end{array} \]
Alternative 3
Accuracy77.0%
Cost977
\[\begin{array}{l} \mathbf{if}\;t \leq -2.3 \cdot 10^{-72}:\\ \;\;\;\;\frac{\frac{x}{y}}{t}\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;t \leq 8.5 \cdot 10^{-44} \lor \neg \left(t \leq 7.5 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z - t}\\ \end{array} \]
Alternative 4
Accuracy79.5%
Cost977
\[\begin{array}{l} t_1 := \frac{\frac{x}{t}}{y - z}\\ \mathbf{if}\;t \leq -5.4 \cdot 10^{-29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{x}{z}}{z - y}\\ \mathbf{elif}\;t \leq 9.5 \cdot 10^{-45} \lor \neg \left(t \leq 7.2 \cdot 10^{+58}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z - t}\\ \end{array} \]
Alternative 5
Accuracy79.5%
Cost977
\[\begin{array}{l} t_1 := \frac{\frac{x}{t}}{y - z}\\ \mathbf{if}\;t \leq -3.15 \cdot 10^{-27}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t \leq 1.6 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{x}{z}}{z - y}\\ \mathbf{elif}\;t \leq 5.5 \cdot 10^{-45} \lor \neg \left(t \leq 7.2 \cdot 10^{+58}\right):\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z - t}}{z}\\ \end{array} \]
Alternative 6
Accuracy70.6%
Cost976
\[\begin{array}{l} t_1 := \frac{\frac{x}{z}}{z}\\ \mathbf{if}\;z \leq -6.2 \cdot 10^{+154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -2.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - y\right)}\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-123}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+149}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Accuracy78.5%
Cost976
\[\begin{array}{l} t_1 := \frac{\frac{x}{z}}{z - y}\\ \mathbf{if}\;z \leq -5.2 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq -7.5 \cdot 10^{-307}:\\ \;\;\;\;-\frac{\frac{x}{y}}{z - t}\\ \mathbf{elif}\;z \leq 6 \cdot 10^{-74}:\\ \;\;\;\;\frac{\frac{x}{t}}{y - z}\\ \mathbf{elif}\;z \leq 2.2 \cdot 10^{-68}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{z - t}\\ \end{array} \]
Alternative 8
Accuracy68.1%
Cost844
\[\begin{array}{l} t_1 := \frac{\frac{x}{z}}{z}\\ \mathbf{if}\;z \leq -5.4 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 4.3 \cdot 10^{-123}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \mathbf{elif}\;z \leq 3.8 \cdot 10^{+149}:\\ \;\;\;\;\frac{x}{z \cdot \left(z - t\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 9
Accuracy93.0%
Cost841
\[\begin{array}{l} \mathbf{if}\;z \leq -4.9 \cdot 10^{+122} \lor \neg \left(z \leq 1.15 \cdot 10^{+151}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - z\right) \cdot \left(t - z\right)}\\ \end{array} \]
Alternative 10
Accuracy64.4%
Cost780
\[\begin{array}{l} t_1 := \frac{\frac{x}{z}}{z}\\ \mathbf{if}\;z \leq -5 \cdot 10^{-6}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;z \leq 5.4 \cdot 10^{-123}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \mathbf{elif}\;z \leq 3.3 \cdot 10^{-28}:\\ \;\;\;\;-\frac{x}{z \cdot t}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Accuracy45.1%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -1.4 \lor \neg \left(z \leq 2.1 \cdot 10^{+151}\right):\\ \;\;\;\;\frac{x}{y \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \end{array} \]
Alternative 12
Accuracy62.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -4.8 \cdot 10^{-6} \lor \neg \left(z \leq 1.3 \cdot 10^{-15}\right):\\ \;\;\;\;\frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y \cdot t}\\ \end{array} \]
Alternative 13
Accuracy63.2%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -6.1 \cdot 10^{-6} \lor \neg \left(z \leq 5 \cdot 10^{-28}\right):\\ \;\;\;\;\frac{x}{z \cdot z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y}\\ \end{array} \]
Alternative 14
Accuracy66.7%
Cost585
\[\begin{array}{l} \mathbf{if}\;z \leq -5.6 \cdot 10^{-6} \lor \neg \left(z \leq 5 \cdot 10^{-28}\right):\\ \;\;\;\;\frac{\frac{x}{z}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{t}}{y}\\ \end{array} \]
Alternative 15
Accuracy38.0%
Cost320
\[\frac{x}{y \cdot t} \]

Error

Reproduce?

herbie shell --seed 2023137 
(FPCore (x y z t)
  :name "Data.Random.Distribution.Triangular:triangularCDF from random-fu-0.2.6.2, B"
  :precision binary64

  :herbie-target
  (if (< (/ x (* (- y z) (- t z))) 0.0) (/ (/ x (- y z)) (- t z)) (* x (/ 1.0 (* (- y z) (- t z)))))

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