Average Error: 12.7 → 3.2
Time: 16.6s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.856877149811500137575176024355404248892 \cdot 10^{-44}:\\ \;\;\;\;\frac{y - z}{y} \cdot x\\ \mathbf{elif}\;y \le -5.930195457290963565232371333597639522659 \cdot 10^{-283}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{y} \cdot x\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;y \le -2.856877149811500137575176024355404248892 \cdot 10^{-44}:\\
\;\;\;\;\frac{y - z}{y} \cdot x\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r32929619 = x;
        double r32929620 = y;
        double r32929621 = z;
        double r32929622 = r32929620 - r32929621;
        double r32929623 = r32929619 * r32929622;
        double r32929624 = r32929623 / r32929620;
        return r32929624;
}

double f(double x, double y, double z) {
        double r32929625 = y;
        double r32929626 = -2.8568771498115e-44;
        bool r32929627 = r32929625 <= r32929626;
        double r32929628 = z;
        double r32929629 = r32929625 - r32929628;
        double r32929630 = r32929629 / r32929625;
        double r32929631 = x;
        double r32929632 = r32929630 * r32929631;
        double r32929633 = -5.930195457290964e-283;
        bool r32929634 = r32929625 <= r32929633;
        double r32929635 = r32929631 * r32929629;
        double r32929636 = r32929635 / r32929625;
        double r32929637 = r32929634 ? r32929636 : r32929632;
        double r32929638 = r32929627 ? r32929632 : r32929637;
        return r32929638;
}

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.3
Herbie3.2
\[\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 2 regimes
  2. if y < -2.8568771498115e-44 or -5.930195457290964e-283 < y

    1. Initial program 13.6

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{y}{y - z}}{x}}}\]
    6. Using strategy rm
    7. Applied div-inv2.1

      \[\leadsto \frac{1}{\color{blue}{\frac{y}{y - z} \cdot \frac{1}{x}}}\]
    8. Applied add-cube-cbrt2.1

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{y}{y - z}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x}}}\]
    10. Simplified2.3

      \[\leadsto \color{blue}{\frac{y - z}{y}} \cdot \frac{\sqrt[3]{1}}{\frac{1}{x}}\]
    11. Simplified2.2

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

    if -2.8568771498115e-44 < y < -5.930195457290964e-283

    1. Initial program 8.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.856877149811500137575176024355404248892 \cdot 10^{-44}:\\ \;\;\;\;\frac{y - z}{y} \cdot x\\ \mathbf{elif}\;y \le -5.930195457290963565232371333597639522659 \cdot 10^{-283}:\\ \;\;\;\;\frac{x \cdot \left(y - z\right)}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{y} \cdot x\\ \end{array}\]

Reproduce

herbie shell --seed 2019169 +o rules:numerics
(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))