Average Error: 11.4 → 3.0
Time: 12.7s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.854341452353873 \cdot 10^{-96}:\\ \;\;\;\;\frac{x}{\frac{1}{y - z} \cdot y}\\ \mathbf{elif}\;y \le 6.662421720446094 \cdot 10^{-114}:\\ \;\;\;\;\frac{\left(-x \cdot z\right) + x \cdot y}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;y \le -5.854341452353873 \cdot 10^{-96}:\\
\;\;\;\;\frac{x}{\frac{1}{y - z} \cdot y}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r28659420 = x;
        double r28659421 = y;
        double r28659422 = z;
        double r28659423 = r28659421 - r28659422;
        double r28659424 = r28659420 * r28659423;
        double r28659425 = r28659424 / r28659421;
        return r28659425;
}

double f(double x, double y, double z) {
        double r28659426 = y;
        double r28659427 = -5.854341452353873e-96;
        bool r28659428 = r28659426 <= r28659427;
        double r28659429 = x;
        double r28659430 = 1.0;
        double r28659431 = z;
        double r28659432 = r28659426 - r28659431;
        double r28659433 = r28659430 / r28659432;
        double r28659434 = r28659433 * r28659426;
        double r28659435 = r28659429 / r28659434;
        double r28659436 = 6.662421720446094e-114;
        bool r28659437 = r28659426 <= r28659436;
        double r28659438 = r28659429 * r28659431;
        double r28659439 = -r28659438;
        double r28659440 = r28659429 * r28659426;
        double r28659441 = r28659439 + r28659440;
        double r28659442 = r28659441 / r28659426;
        double r28659443 = r28659432 / r28659426;
        double r28659444 = r28659429 * r28659443;
        double r28659445 = r28659437 ? r28659442 : r28659444;
        double r28659446 = r28659428 ? r28659435 : r28659445;
        return r28659446;
}

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

Original11.4
Target2.8
Herbie3.0
\[\begin{array}{l} \mathbf{if}\;z \lt -2.060202331921739 \cdot 10^{+104}:\\ \;\;\;\;x - \frac{z \cdot x}{y}\\ \mathbf{elif}\;z \lt 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 3 regimes
  2. if y < -5.854341452353873e-96

    1. Initial program 12.5

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

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

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

    if -5.854341452353873e-96 < y < 6.662421720446094e-114

    1. Initial program 9.2

      \[\frac{x \cdot \left(y - z\right)}{y}\]
    2. Using strategy rm
    3. Applied sub-neg9.2

      \[\leadsto \frac{x \cdot \color{blue}{\left(y + \left(-z\right)\right)}}{y}\]
    4. Applied distribute-rgt-in9.2

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

    if 6.662421720446094e-114 < y

    1. Initial program 11.9

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.854341452353873 \cdot 10^{-96}:\\ \;\;\;\;\frac{x}{\frac{1}{y - z} \cdot y}\\ \mathbf{elif}\;y \le 6.662421720446094 \cdot 10^{-114}:\\ \;\;\;\;\frac{\left(-x \cdot z\right) + x \cdot y}{y}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019158 
(FPCore (x y z)
  :name "Diagrams.Backend.Cairo.Internal:setTexture from diagrams-cairo-1.3.0.3"

  :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))