Average Error: 11.7 → 3.1
Time: 6.2s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -7.326181763082673 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \mathbf{elif}\;y \le 2.6779333906407255 \cdot 10^{-232}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{1}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;y \le -7.326181763082673 \cdot 10^{-13}:\\
\;\;\;\;x \cdot \frac{y - z}{y}\\

\mathbf{elif}\;y \le 2.6779333906407255 \cdot 10^{-232}:\\
\;\;\;\;\frac{\frac{x}{y}}{\frac{1}{y - z}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r13727296 = x;
        double r13727297 = y;
        double r13727298 = z;
        double r13727299 = r13727297 - r13727298;
        double r13727300 = r13727296 * r13727299;
        double r13727301 = r13727300 / r13727297;
        return r13727301;
}

double f(double x, double y, double z) {
        double r13727302 = y;
        double r13727303 = -7.326181763082673e-13;
        bool r13727304 = r13727302 <= r13727303;
        double r13727305 = x;
        double r13727306 = z;
        double r13727307 = r13727302 - r13727306;
        double r13727308 = r13727307 / r13727302;
        double r13727309 = r13727305 * r13727308;
        double r13727310 = 2.6779333906407255e-232;
        bool r13727311 = r13727302 <= r13727310;
        double r13727312 = r13727305 / r13727302;
        double r13727313 = 1.0;
        double r13727314 = r13727313 / r13727307;
        double r13727315 = r13727312 / r13727314;
        double r13727316 = r13727302 / r13727307;
        double r13727317 = r13727305 / r13727316;
        double r13727318 = r13727311 ? r13727315 : r13727317;
        double r13727319 = r13727304 ? r13727309 : r13727318;
        return r13727319;
}

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.7
Target3.2
Herbie3.1
\[\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 < -7.326181763082673e-13

    1. Initial program 14.4

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

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

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

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

    if -7.326181763082673e-13 < y < 2.6779333906407255e-232

    1. Initial program 8.1

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

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

      \[\leadsto \frac{x}{\color{blue}{y \cdot \frac{1}{y - z}}}\]
    6. Applied associate-/r*8.9

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

    if 2.6779333906407255e-232 < y

    1. Initial program 11.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -7.326181763082673 \cdot 10^{-13}:\\ \;\;\;\;x \cdot \frac{y - z}{y}\\ \mathbf{elif}\;y \le 2.6779333906407255 \cdot 10^{-232}:\\ \;\;\;\;\frac{\frac{x}{y}}{\frac{1}{y - z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]

Reproduce

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