?

Average Error: 11.9 → 1.6
Time: 4.1s
Precision: binary64
Cost: 1481

?

\[\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 \lor \neg \left(t_0 \leq -2 \cdot 10^{+57}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y + z}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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 (or (<= t_0 (- INFINITY)) (not (<= t_0 -2e+57)))
     (/ x (/ z (+ y z)))
     t_0)))
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)) || !(t_0 <= -2e+57)) {
		tmp = x / (z / (y + z));
	} else {
		tmp = t_0;
	}
	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) || !(t_0 <= -2e+57)) {
		tmp = x / (z / (y + z));
	} else {
		tmp = t_0;
	}
	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) or not (t_0 <= -2e+57):
		tmp = x / (z / (y + z))
	else:
		tmp = t_0
	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)) || !(t_0 <= -2e+57))
		tmp = Float64(x / Float64(z / Float64(y + z)));
	else
		tmp = t_0;
	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) || ~((t_0 <= -2e+57)))
		tmp = x / (z / (y + z));
	else
		tmp = t_0;
	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[Or[LessEqual[t$95$0, (-Infinity)], N[Not[LessEqual[t$95$0, -2e+57]], $MachinePrecision]], N[(x / N[(z / N[(y + z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\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 \lor \neg \left(t_0 \leq -2 \cdot 10^{+57}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original11.9
Target3.2
Herbie1.6
\[\frac{x}{\frac{z}{y + z}} \]

Derivation?

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

    1. Initial program 14.3

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

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

      [Start]14.3

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

      associate-/l* [=>]1.9

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

    if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -2.0000000000000001e57

    1. Initial program 0.2

      \[\frac{x \cdot \left(y + z\right)}{z} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.6

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

Alternatives

Alternative 1
Error20.7
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -1.56 \cdot 10^{-51}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 5.5 \cdot 10^{-196} \lor \neg \left(z \leq 2.3 \cdot 10^{-166}\right) \land z \leq 2.6 \cdot 10^{-118}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 2
Error19.2
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -2 \cdot 10^{-55}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 7.3 \cdot 10^{-196} \lor \neg \left(z \leq 2.3 \cdot 10^{-166}\right) \land z \leq 1.06 \cdot 10^{-106}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Error19.2
Cost849
\[\begin{array}{l} \mathbf{if}\;z \leq -6.1 \cdot 10^{-49}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 6.6 \cdot 10^{-196} \lor \neg \left(z \leq 2.35 \cdot 10^{-166}\right) \land z \leq 3.8 \cdot 10^{-109}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Error7.8
Cost712
\[\begin{array}{l} \mathbf{if}\;z \leq -2.5 \cdot 10^{+126}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 1.26 \cdot 10^{+169}:\\ \;\;\;\;\left(y + z\right) \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Error3.2
Cost448
\[\frac{x}{\frac{z}{y + z}} \]
Alternative 6
Error25.9
Cost64
\[x \]

Error

Reproduce?

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