Average Error: 12.3 → 0.6
Time: 3.0s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -inf.0:\\ \;\;\;\;x - \left(\sqrt[3]{x \cdot \frac{z}{y}} \cdot \sqrt[3]{x \cdot \frac{z}{y}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{z}{y}}\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -1.08864706213862188 \cdot 10^{-39}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.9376621052131412 \cdot 10^{112}:\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.5239110264834849 \cdot 10^{302}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{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} = -inf.0:\\
\;\;\;\;x - \left(\sqrt[3]{x \cdot \frac{z}{y}} \cdot \sqrt[3]{x \cdot \frac{z}{y}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{z}{y}}\right)\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -1.08864706213862188 \cdot 10^{-39}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.9376621052131412 \cdot 10^{112}:\\
\;\;\;\;x - x \cdot \frac{z}{y}\\

\mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.5239110264834849 \cdot 10^{302}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\

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

\end{array}
double code(double x, double y, double z) {
	return ((double) (((double) (x * ((double) (y - z)))) / y));
}
double code(double x, double y, double z) {
	double VAR;
	if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -inf.0)) {
		VAR = ((double) (x - ((double) (((double) (((double) cbrt(((double) (x * ((double) (z / y)))))) * ((double) cbrt(((double) (x * ((double) (z / y)))))))) * ((double) (((double) cbrt(x)) * ((double) cbrt(((double) (z / y))))))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -1.0886470621386219e-39)) {
			VAR_1 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
		} else {
			double VAR_2;
			if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 2.937662105213141e+112)) {
				VAR_2 = ((double) (x - ((double) (x * ((double) (z / y))))));
			} else {
				double VAR_3;
				if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= 1.523911026483485e+302)) {
					VAR_3 = ((double) (x + ((double) (((double) (x * z)) * ((double) (-1.0 / y))))));
				} else {
					VAR_3 = ((double) (x - ((double) (z * ((double) (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.3
Target3.0
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739 \cdot 10^{104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 1.69397660138285259 \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 4 regimes
  2. if (/ (* x (- y z)) y) < -inf.0

    1. Initial program 64.0

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

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

      \[\leadsto x - \color{blue}{\left(\sqrt[3]{x \cdot \frac{z}{y}} \cdot \sqrt[3]{x \cdot \frac{z}{y}}\right) \cdot \sqrt[3]{x \cdot \frac{z}{y}}}\]
    5. Using strategy rm
    6. Applied cbrt-prod0.2

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

    if -inf.0 < (/ (* x (- y z)) y) < -1.08864706213862188e-39 or 2.9376621052131412e112 < (/ (* x (- y z)) y) < 1.5239110264834849e302

    1. Initial program 0.2

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

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

      \[\leadsto x - x \cdot \color{blue}{\left(z \cdot \frac{1}{y}\right)}\]
    5. Applied associate-*r*0.2

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

    if -1.08864706213862188e-39 < (/ (* x (- y z)) y) < 2.9376621052131412e112

    1. Initial program 5.5

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

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

    if 1.5239110264834849e302 < (/ (* x (- y z)) y)

    1. Initial program 61.7

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

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

      \[\leadsto x - x \cdot \frac{z}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}\]
    5. Applied *-un-lft-identity1.1

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

      \[\leadsto x - x \cdot \color{blue}{\left(\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{z}{\sqrt[3]{y}}\right)}\]
    7. Applied associate-*r*1.0

      \[\leadsto x - \color{blue}{\left(x \cdot \frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}}\right) \cdot \frac{z}{\sqrt[3]{y}}}\]
    8. Simplified1.0

      \[\leadsto x - \color{blue}{\frac{x}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{z}{\sqrt[3]{y}}\]
    9. Taylor expanded around 0 21.2

      \[\leadsto x - \color{blue}{\frac{x \cdot z}{y}}\]
    10. Simplified1.0

      \[\leadsto x - \color{blue}{z \cdot \frac{x}{y}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -inf.0:\\ \;\;\;\;x - \left(\sqrt[3]{x \cdot \frac{z}{y}} \cdot \sqrt[3]{x \cdot \frac{z}{y}}\right) \cdot \left(\sqrt[3]{x} \cdot \sqrt[3]{\frac{z}{y}}\right)\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -1.08864706213862188 \cdot 10^{-39}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.9376621052131412 \cdot 10^{112}:\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.5239110264834849 \cdot 10^{302}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\ \mathbf{else}:\\ \;\;\;\;x - z \cdot \frac{x}{y}\\ \end{array}\]

Reproduce

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