Average Error: 12.9 → 3.3
Time: 1.9s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;y \le 1.3574032127967498 \cdot 10^{63}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;y \le 1.3574032127967498 \cdot 10^{63}:\\
\;\;\;\;x - \frac{x \cdot z}{y}\\

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

\end{array}
double f(double x, double y, double z) {
        double r689056 = x;
        double r689057 = y;
        double r689058 = z;
        double r689059 = r689057 - r689058;
        double r689060 = r689056 * r689059;
        double r689061 = r689060 / r689057;
        return r689061;
}

double f(double x, double y, double z) {
        double r689062 = y;
        double r689063 = 1.3574032127967498e+63;
        bool r689064 = r689062 <= r689063;
        double r689065 = x;
        double r689066 = z;
        double r689067 = r689065 * r689066;
        double r689068 = r689067 / r689062;
        double r689069 = r689065 - r689068;
        double r689070 = r689066 / r689062;
        double r689071 = r689065 * r689070;
        double r689072 = r689065 - r689071;
        double r689073 = r689064 ? r689069 : r689072;
        return r689073;
}

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.9
Target3.0
Herbie3.3
\[\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 2 regimes
  2. if y < 1.3574032127967498e+63

    1. Initial program 10.6

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

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
    4. Taylor expanded around 0 4.3

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

    if 1.3574032127967498e+63 < y

    1. Initial program 20.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{y}{y - z}}}\]
    4. Taylor expanded around 0 6.9

      \[\leadsto \color{blue}{x - \frac{x \cdot z}{y}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity6.9

      \[\leadsto x - \frac{x \cdot z}{\color{blue}{1 \cdot y}}\]
    7. Applied times-frac0.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 1.3574032127967498 \cdot 10^{63}:\\ \;\;\;\;x - \frac{x \cdot z}{y}\\ \mathbf{else}:\\ \;\;\;\;x - x \cdot \frac{z}{y}\\ \end{array}\]

Reproduce

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