?

Average Accuracy: 80.9% → 97.5%
Time: 7.1s
Precision: binary64
Cost: 1480

?

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

\mathbf{elif}\;t_0 \leq -2 \cdot 10^{-89}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original80.9%
Target95.0%
Herbie97.5%
\[\frac{x}{\frac{z}{y + z}} \]

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{x \cdot \frac{y + z}{z}} \]
      Proof

      [Start]0.0

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

      associate-*r/ [<=]99.9

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -2.00000000000000008e-89

    1. Initial program 99.6%

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

    if -2.00000000000000008e-89 < (/.f64 (*.f64 x (+.f64 y z)) z)

    1. Initial program 81.8%

      \[\frac{x \cdot \left(y + z\right)}{z} \]
    2. Simplified96.4%

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

      [Start]81.8

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

      associate-/l* [=>]96.4

      \[ \color{blue}{\frac{x}{\frac{z}{y + z}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification97.5%

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

Alternatives

Alternative 1
Accuracy70.0%
Cost585
\[\begin{array}{l} \mathbf{if}\;y \leq -4.5 \cdot 10^{+66} \lor \neg \left(y \leq 7.8 \cdot 10^{-14}\right):\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Accuracy69.7%
Cost584
\[\begin{array}{l} \mathbf{if}\;y \leq -5.5 \cdot 10^{+66}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-14}:\\ \;\;\;\;x\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array} \]
Alternative 3
Accuracy94.5%
Cost448
\[x \cdot \frac{y + z}{z} \]
Alternative 4
Accuracy94.5%
Cost448
\[x + x \cdot \frac{y}{z} \]
Alternative 5
Accuracy95.0%
Cost448
\[\frac{x}{\frac{z}{y + z}} \]
Alternative 6
Accuracy59.4%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023140 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))