Average Error: 12.6 → 1.7
Time: 2.4s
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 - x \cdot \frac{z}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -3.685233061790574 \cdot 10^{-275}:\\ \;\;\;\;x - \left(x \cdot z\right) \cdot \frac{1}{y}\\ \mathbf{else}:\\ \;\;\;\;x - \left(x \cdot \frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}}\right) \cdot \frac{1}{\sqrt[3]{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 - x \cdot \frac{z}{y}\\

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

\mathbf{else}:\\
\;\;\;\;x - \left(x \cdot \frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}}\right) \cdot \frac{1}{\sqrt[3]{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) (x * ((double) (z / y))))));
	} else {
		double VAR_1;
		if ((((double) (((double) (x * ((double) (y - z)))) / y)) <= -3.685233061790574e-275)) {
			VAR_1 = ((double) (x - ((double) (((double) (x * z)) * ((double) (1.0 / y))))));
		} else {
			VAR_1 = ((double) (x - ((double) (((double) (x * ((double) (z / ((double) (((double) cbrt(y)) * ((double) cbrt(y)))))))) * ((double) (1.0 / ((double) cbrt(y))))))));
		}
		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.6
Target3.1
Herbie1.7
\[\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 3 regimes
  2. if (/ (* x (- y z)) y) < -inf.0

    1. Initial program 64.0

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

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

    if -inf.0 < (/ (* x (- y z)) y) < -3.685233061790574e-275

    1. Initial program 0.4

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

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

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

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

    if -3.685233061790574e-275 < (/ (* x (- y z)) y)

    1. Initial program 14.1

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

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

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

      \[\leadsto x - \color{blue}{\left(x \cdot z\right) \cdot \frac{1}{y}}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt5.6

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

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

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

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

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

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

Reproduce

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