Average Error: 12.7 → 0.4
Time: 2.5s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -\infty:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -5.74240735694960229 \cdot 10^{-106}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.0101904628573289 \cdot 10^{139}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 3.14880917404541375 \cdot 10^{307}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(y - z\right)\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -\infty:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\

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

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r836303 = x;
        double r836304 = y;
        double r836305 = z;
        double r836306 = r836304 - r836305;
        double r836307 = r836303 * r836306;
        double r836308 = r836307 / r836304;
        return r836308;
}

double f(double x, double y, double z) {
        double r836309 = x;
        double r836310 = y;
        double r836311 = z;
        double r836312 = r836310 - r836311;
        double r836313 = r836309 * r836312;
        double r836314 = r836313 / r836310;
        double r836315 = -inf.0;
        bool r836316 = r836314 <= r836315;
        double r836317 = r836310 / r836312;
        double r836318 = r836309 / r836317;
        double r836319 = -5.742407356949602e-106;
        bool r836320 = r836314 <= r836319;
        double r836321 = 1.0101904628573289e+139;
        bool r836322 = r836314 <= r836321;
        double r836323 = 3.1488091740454137e+307;
        bool r836324 = r836314 <= r836323;
        double r836325 = r836309 / r836310;
        double r836326 = r836325 * r836312;
        double r836327 = r836324 ? r836314 : r836326;
        double r836328 = r836322 ? r836318 : r836327;
        double r836329 = r836320 ? r836314 : r836328;
        double r836330 = r836316 ? r836318 : r836329;
        return r836330;
}

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.7
Target3.4
Herbie0.4
\[\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 or -5.742407356949602e-106 < (/ (* x (- y z)) y) < 1.0101904628573289e+139

    1. Initial program 14.1

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied associate-/l*0.6

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

    if -inf.0 < (/ (* x (- y z)) y) < -5.742407356949602e-106 or 1.0101904628573289e+139 < (/ (* x (- y z)) y) < 3.1488091740454137e+307

    1. Initial program 0.3

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

    if 3.1488091740454137e+307 < (/ (* x (- y z)) y)

    1. Initial program 63.7

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied associate-/l*0.3

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot \left(y - z\right)}{y} = -\infty:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le -5.74240735694960229 \cdot 10^{-106}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 1.0101904628573289 \cdot 10^{139}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 3.14880917404541375 \cdot 10^{307}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{y} \cdot \left(y - z\right)\\ \end{array}\]

Reproduce

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