Average Error: 12.6 → 0.8
Time: 3.3s
Precision: binary64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -5.317413615517461 \cdot 10^{+285} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq -1.1913190036143335 \cdot 10^{+87} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq 2.5042457577934314 \cdot 10^{-19}\right) \land \frac{x \cdot \left(y - z\right)}{y} \leq 2.3420284491870442 \cdot 10^{+266}\right):\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{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 -5.317413615517461 \cdot 10^{+285} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq -1.1913190036143335 \cdot 10^{+87} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq 2.5042457577934314 \cdot 10^{-19}\right) \land \frac{x \cdot \left(y - z\right)}{y} \leq 2.3420284491870442 \cdot 10^{+266}\right):\\
\;\;\;\;x - x \cdot \frac{z}{y}\\

\mathbf{else}:\\
\;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\

\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (- y z)) y))
(FPCore (x y z)
 :precision binary64
 (if (or (<= (/ (* x (- y z)) y) -5.317413615517461e+285)
         (not
          (or (<= (/ (* x (- y z)) y) -1.1913190036143335e+87)
              (and (not (<= (/ (* x (- y z)) y) 2.5042457577934314e-19))
                   (<= (/ (* x (- y z)) y) 2.3420284491870442e+266)))))
   (- x (* x (/ z y)))
   (+ x (* (* x z) (/ -1.0 y)))))
double code(double x, double y, double z) {
	return (((double) (x * ((double) (y - z)))) / y);
}
double code(double x, double y, double z) {
	double tmp;
	if ((((((double) (x * ((double) (y - z)))) / y) <= -5.317413615517461e+285) || !(((((double) (x * ((double) (y - z)))) / y) <= -1.1913190036143335e+87) || (!((((double) (x * ((double) (y - z)))) / y) <= 2.5042457577934314e-19) && ((((double) (x * ((double) (y - z)))) / y) <= 2.3420284491870442e+266))))) {
		tmp = ((double) (x - ((double) (x * (z / y)))));
	} else {
		tmp = ((double) (x + ((double) (((double) (x * z)) * (-1.0 / y)))));
	}
	return tmp;
}

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.3
Herbie0.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 (/ (* x (- y z)) y) < -5.31741361551746132e285 or -1.1913190036143335e87 < (/ (* x (- y z)) y) < 2.50424575779343136e-19 or 2.3420284491870442e266 < (/ (* x (- y z)) y)

    1. Initial program Error: 19.2 bits

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. SimplifiedError: 1.1 bits

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

    if -5.31741361551746132e285 < (/ (* x (- y z)) y) < -1.1913190036143335e87 or 2.50424575779343136e-19 < (/ (* x (- y z)) y) < 2.3420284491870442e266

    1. Initial program Error: 0.2 bits

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. SimplifiedError: 7.6 bits

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

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

      \[\leadsto x - \color{blue}{\left(x \cdot z\right) \cdot \frac{1}{y}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplificationError: 0.8 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} \leq -5.317413615517461 \cdot 10^{+285} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq -1.1913190036143335 \cdot 10^{+87} \lor \neg \left(\frac{x \cdot \left(y - z\right)}{y} \leq 2.5042457577934314 \cdot 10^{-19}\right) \land \frac{x \cdot \left(y - z\right)}{y} \leq 2.3420284491870442 \cdot 10^{+266}\right):\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \mathbf{else}:\\ \;\;\;\;x + \left(x \cdot z\right) \cdot \frac{-1}{y}\\ \end{array}\]

Reproduce

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