Average Error: 12.0 → 0.5
Time: 3.1s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -\infty:\\ \;\;\;\;x - z \cdot \frac{x}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -6.659376642994718 \cdot 10^{-98}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -0:\\ \;\;\;\;x - {\left(\sqrt[3]{x}\right)}^{2} \cdot \left(\sqrt[3]{x} \cdot \frac{z}{y}\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq 1.1993304859552876 \cdot 10^{+303}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \frac{x}{y}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -\infty:\\
\;\;\;\;x - z \cdot \frac{x}{y}\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -6.659376642994718 \cdot 10^{-98}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq -0:\\
\;\;\;\;x - {\left(\sqrt[3]{x}\right)}^{2} \cdot \left(\sqrt[3]{x} \cdot \frac{z}{y}\right)\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \leq 1.1993304859552876 \cdot 10^{+303}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\

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

\end{array}
double code(double x, double y, double z) {
	return (((double) (x * ((double) (y - z)))) / y);
}
double code(double x, double y, double z) {
	double VAR;
	if (((((double) (x * ((double) (y - z)))) / y) <= ((double) -(((double) INFINITY))))) {
		VAR = ((double) (x - ((double) (z * (x / y)))));
	} else {
		double VAR_1;
		if (((((double) (x * ((double) (y - z)))) / y) <= -6.659376642994718e-98)) {
			VAR_1 = (((double) (x * ((double) (y - z)))) / y);
		} else {
			double VAR_2;
			if (((((double) (x * ((double) (y - z)))) / y) <= -0.0)) {
				VAR_2 = ((double) (x - ((double) (((double) pow(((double) cbrt(x)), 2.0)) * ((double) (((double) cbrt(x)) * (z / y)))))));
			} else {
				double VAR_3;
				if (((((double) (x * ((double) (y - z)))) / y) <= 1.1993304859552876e+303)) {
					VAR_3 = (((double) (x * ((double) (y - z)))) / y);
				} else {
					VAR_3 = ((double) (x - ((double) (z * (x / y)))));
				}
				VAR_2 = VAR_3;
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.0
Target3.1
Herbie0.5
\[\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 3 regimes
  2. if (/ (* x (- y z)) y) < -inf.0 or 1.19933048595528755e303 < (/ (* x (- y z)) y)

    1. Initial program 62.4

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Simplified0.4

      \[\leadsto \color{blue}{x - x \cdot \frac{z}{y}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.6

      \[\leadsto x - \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \frac{z}{y}\]
    5. Applied associate-*l*0.6

      \[\leadsto x - \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \frac{z}{y}\right)}\]
    6. Simplified0.6

      \[\leadsto x - \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\frac{z}{y} \cdot \sqrt[3]{x}\right)}\]
    7. Taylor expanded around 0 18.7

      \[\leadsto x - \color{blue}{\frac{x \cdot z}{y}}\]
    8. Simplified0.8

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

    if -inf.0 < (/ (* x (- y z)) y) < -6.65937664299471807e-98 or -0.0 < (/ (* x (- y z)) y) < 1.19933048595528755e303

    1. Initial program 0.4

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

    if -6.65937664299471807e-98 < (/ (* x (- y z)) y) < -0.0

    1. Initial program 17.8

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Simplified0.1

      \[\leadsto \color{blue}{x - x \cdot \frac{z}{y}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt0.4

      \[\leadsto x - \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}\right)} \cdot \frac{z}{y}\]
    5. Applied associate-*l*0.4

      \[\leadsto x - \color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \left(\sqrt[3]{x} \cdot \frac{z}{y}\right)}\]
    6. Simplified0.4

      \[\leadsto x - \left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \color{blue}{\left(\frac{z}{y} \cdot \sqrt[3]{x}\right)}\]
    7. Using strategy rm
    8. Applied pow10.4

      \[\leadsto x - \left(\sqrt[3]{x} \cdot \color{blue}{{\left(\sqrt[3]{x}\right)}^{1}}\right) \cdot \left(\frac{z}{y} \cdot \sqrt[3]{x}\right)\]
    9. Applied pow10.4

      \[\leadsto x - \left(\color{blue}{{\left(\sqrt[3]{x}\right)}^{1}} \cdot {\left(\sqrt[3]{x}\right)}^{1}\right) \cdot \left(\frac{z}{y} \cdot \sqrt[3]{x}\right)\]
    10. Applied pow-prod-up0.4

      \[\leadsto x - \color{blue}{{\left(\sqrt[3]{x}\right)}^{\left(1 + 1\right)}} \cdot \left(\frac{z}{y} \cdot \sqrt[3]{x}\right)\]
    11. Simplified0.4

      \[\leadsto x - {\left(\sqrt[3]{x}\right)}^{\color{blue}{2}} \cdot \left(\frac{z}{y} \cdot \sqrt[3]{x}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

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

Reproduce

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