?

Average Accuracy: 84.5% → 98.8%
Time: 8.0s
Precision: binary64
Cost: 2514

?

\[\frac{x \cdot \left(y - z\right)}{y} \]
\[\begin{array}{l} t_0 := \frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq -5 \cdot 10^{-229}\right) \land \left(t_0 \leq 2 \cdot 10^{-152} \lor \neg \left(t_0 \leq 10^{+288}\right)\right):\\ \;\;\;\;x - z \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (/ (* x (- y z)) y)))
   (if (or (<= t_0 (- INFINITY))
           (and (not (<= t_0 -5e-229))
                (or (<= t_0 2e-152) (not (<= t_0 1e+288)))))
     (- x (* z (/ x y)))
     t_0)))
double code(double x, double y, double z) {
	return (x * (y - z)) / y;
}
double code(double x, double y, double z) {
	double t_0 = (x * (y - z)) / y;
	double tmp;
	if ((t_0 <= -((double) INFINITY)) || (!(t_0 <= -5e-229) && ((t_0 <= 2e-152) || !(t_0 <= 1e+288)))) {
		tmp = x - (z * (x / y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double x, double y, double z) {
	return (x * (y - z)) / y;
}
public static double code(double x, double y, double z) {
	double t_0 = (x * (y - z)) / y;
	double tmp;
	if ((t_0 <= -Double.POSITIVE_INFINITY) || (!(t_0 <= -5e-229) && ((t_0 <= 2e-152) || !(t_0 <= 1e+288)))) {
		tmp = x - (z * (x / y));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x, y, z):
	return (x * (y - z)) / y
def code(x, y, z):
	t_0 = (x * (y - z)) / y
	tmp = 0
	if (t_0 <= -math.inf) or (not (t_0 <= -5e-229) and ((t_0 <= 2e-152) or not (t_0 <= 1e+288))):
		tmp = x - (z * (x / y))
	else:
		tmp = t_0
	return tmp
function code(x, y, z)
	return Float64(Float64(x * Float64(y - z)) / y)
end
function code(x, y, z)
	t_0 = Float64(Float64(x * Float64(y - z)) / y)
	tmp = 0.0
	if ((t_0 <= Float64(-Inf)) || (!(t_0 <= -5e-229) && ((t_0 <= 2e-152) || !(t_0 <= 1e+288))))
		tmp = Float64(x - Float64(z * Float64(x / y)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp = code(x, y, z)
	tmp = (x * (y - z)) / y;
end
function tmp_2 = code(x, y, z)
	t_0 = (x * (y - z)) / y;
	tmp = 0.0;
	if ((t_0 <= -Inf) || (~((t_0 <= -5e-229)) && ((t_0 <= 2e-152) || ~((t_0 <= 1e+288)))))
		tmp = x - (z * (x / y));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x * N[(y - z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]}, If[Or[LessEqual[t$95$0, (-Infinity)], And[N[Not[LessEqual[t$95$0, -5e-229]], $MachinePrecision], Or[LessEqual[t$95$0, 2e-152], N[Not[LessEqual[t$95$0, 1e+288]], $MachinePrecision]]]], N[(x - N[(z * N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y - z\right)}{y}\\
\mathbf{if}\;t_0 \leq -\infty \lor \neg \left(t_0 \leq -5 \cdot 10^{-229}\right) \land \left(t_0 \leq 2 \cdot 10^{-152} \lor \neg \left(t_0 \leq 10^{+288}\right)\right):\\
\;\;\;\;x - z \cdot \frac{x}{y}\\

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


\end{array}

Error?

Bogosity?

Bogosity

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original84.5%
Target96.1%
Herbie98.8%
\[\begin{array}{l} \mathbf{if}\;z < -2.060202331921739 \cdot 10^{+104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z < 1.6939766013828526 \cdot 10^{+213}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\ \end{array} \]

Derivation?

  1. Split input into 2 regimes
  2. if (/.f64 (*.f64 x (-.f64 y z)) y) < -inf.0 or -5.00000000000000016e-229 < (/.f64 (*.f64 x (-.f64 y z)) y) < 2.00000000000000013e-152 or 1e288 < (/.f64 (*.f64 x (-.f64 y z)) y)

    1. Initial program 69.2%

      \[\frac{x \cdot \left(y - z\right)}{y} \]
    2. Simplified100.0%

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

      [Start]69.2

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

      associate-*l/ [<=]91.7

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

      distribute-rgt-out-- [<=]73.0

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

      associate-*r/ [=>]73.4

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

      associate-*l/ [<=]100.0

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

      *-inverses [=>]100.0

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

      *-lft-identity [=>]100.0

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

    if -inf.0 < (/.f64 (*.f64 x (-.f64 y z)) y) < -5.00000000000000016e-229 or 2.00000000000000013e-152 < (/.f64 (*.f64 x (-.f64 y z)) y) < 1e288

    1. Initial program 99.2%

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

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

Alternatives

Alternative 1
Accuracy96.5%
Cost841
\[\begin{array}{l} \mathbf{if}\;x \leq 3.7 \cdot 10^{-196} \lor \neg \left(x \leq 20000000000000\right):\\ \;\;\;\;x \cdot \left(\left(y - z\right) \cdot \frac{1}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \frac{x}{y}\\ \end{array} \]
Alternative 2
Accuracy89.4%
Cost712
\[\begin{array}{l} \mathbf{if}\;y \leq -7.8 \cdot 10^{+171}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 5.3 \cdot 10^{+88}:\\ \;\;\;\;\left(y - z\right) \cdot \frac{x}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 3
Accuracy71.1%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -2.35 \cdot 10^{-13}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 1.22 \cdot 10^{-42}:\\ \;\;\;\;x \cdot \frac{-z}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 4
Accuracy73.6%
Cost648
\[\begin{array}{l} \mathbf{if}\;y \leq -5.4 \cdot 10^{-15}:\\ \;\;\;\;x\\ \mathbf{elif}\;y \leq 8 \cdot 10^{-22}:\\ \;\;\;\;\frac{x \cdot \left(-z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;x\\ \end{array} \]
Alternative 5
Accuracy94.2%
Cost448
\[x - z \cdot \frac{x}{y} \]
Alternative 6
Accuracy51.6%
Cost64
\[x \]

Error

Reproduce?

herbie shell --seed 2023160 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"
  :precision binary64

  :herbie-target
  (if (< z -2.060202331921739e+104) (- x (/ (* z x) y)) (if (< z 1.6939766013828526e+213) (/ x (/ y (- y z))) (* (- y z) (/ x y))))

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