Average Error: 12.7 → 0.7
Time: 7.8s
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 -7.035752593527431893945155653212148797057 \cdot 10^{97}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.566980890461996323345451498436663106865 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 3.205146683618994452349289842865450278396 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \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 -7.035752593527431893945155653212148797057 \cdot 10^{97}:\\
\;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r792412 = x;
        double r792413 = y;
        double r792414 = z;
        double r792415 = r792413 - r792414;
        double r792416 = r792412 * r792415;
        double r792417 = r792416 / r792413;
        return r792417;
}

double f(double x, double y, double z) {
        double r792418 = x;
        double r792419 = y;
        double r792420 = z;
        double r792421 = r792419 - r792420;
        double r792422 = r792418 * r792421;
        double r792423 = r792422 / r792419;
        double r792424 = -inf.0;
        bool r792425 = r792423 <= r792424;
        double r792426 = r792419 / r792421;
        double r792427 = r792418 / r792426;
        double r792428 = -7.035752593527432e+97;
        bool r792429 = r792423 <= r792428;
        double r792430 = 2.5669808904619963e-126;
        bool r792431 = r792423 <= r792430;
        double r792432 = 3.2051466836189945e+270;
        bool r792433 = r792423 <= r792432;
        double r792434 = r792421 / r792419;
        double r792435 = r792418 * r792434;
        double r792436 = r792433 ? r792423 : r792435;
        double r792437 = r792431 ? r792427 : r792436;
        double r792438 = r792429 ? r792423 : r792437;
        double r792439 = r792425 ? r792427 : r792438;
        return r792439;
}

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.2
Herbie0.7
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739024383612783691266533098 \cdot 10^{104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 1.693976601382852594702773997610248441465 \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 -7.035752593527432e+97 < (/ (* x (- y z)) y) < 2.5669808904619963e-126

    1. Initial program 16.2

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

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

    if -inf.0 < (/ (* x (- y z)) y) < -7.035752593527432e+97 or 2.5669808904619963e-126 < (/ (* x (- y z)) y) < 3.2051466836189945e+270

    1. Initial program 0.3

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

    if 3.2051466836189945e+270 < (/ (* x (- y z)) y)

    1. Initial program 49.5

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity49.5

      \[\leadsto \frac{x \cdot \left(y - z\right)}{\color{blue}{1 \cdot y}}\]
    4. Applied times-frac3.2

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y - z}{y}}\]
    5. Simplified3.2

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

    \[\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 -7.035752593527431893945155653212148797057 \cdot 10^{97}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 2.566980890461996323345451498436663106865 \cdot 10^{-126}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{x \cdot \left(y - z\right)}{y} \le 3.205146683618994452349289842865450278396 \cdot 10^{270}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \end{array}\]

Reproduce

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