Average Error: 12.6 → 1.5
Time: 23.8s
Precision: 64
\[\frac{x \cdot \left(y - z\right)}{y}\]
\[\begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot x}{y} \le -6.083035639847637607654497125773830646304 \cdot 10^{292}:\\ \;\;\;\;\frac{\frac{x}{\sqrt{\frac{y}{y - z}}}}{\sqrt{\frac{y}{y - z}}}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le -8.175248265444713739055182742884957439272 \cdot 10^{123}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{y}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le 4597572249704838144:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le 1.095545649072277509917652984108949902858 \cdot 10^{260}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]
\frac{x \cdot \left(y - z\right)}{y}
\begin{array}{l}
\mathbf{if}\;\frac{\left(y - z\right) \cdot x}{y} \le -6.083035639847637607654497125773830646304 \cdot 10^{292}:\\
\;\;\;\;\frac{\frac{x}{\sqrt{\frac{y}{y - z}}}}{\sqrt{\frac{y}{y - z}}}\\

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

\mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le 4597572249704838144:\\
\;\;\;\;\frac{x}{\frac{y}{y - z}}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r38759145 = x;
        double r38759146 = y;
        double r38759147 = z;
        double r38759148 = r38759146 - r38759147;
        double r38759149 = r38759145 * r38759148;
        double r38759150 = r38759149 / r38759146;
        return r38759150;
}

double f(double x, double y, double z) {
        double r38759151 = y;
        double r38759152 = z;
        double r38759153 = r38759151 - r38759152;
        double r38759154 = x;
        double r38759155 = r38759153 * r38759154;
        double r38759156 = r38759155 / r38759151;
        double r38759157 = -6.083035639847638e+292;
        bool r38759158 = r38759156 <= r38759157;
        double r38759159 = r38759151 / r38759153;
        double r38759160 = sqrt(r38759159);
        double r38759161 = r38759154 / r38759160;
        double r38759162 = r38759161 / r38759160;
        double r38759163 = -8.175248265444714e+123;
        bool r38759164 = r38759156 <= r38759163;
        double r38759165 = 4.597572249704838e+18;
        bool r38759166 = r38759156 <= r38759165;
        double r38759167 = r38759154 / r38759159;
        double r38759168 = 1.0955456490722775e+260;
        bool r38759169 = r38759156 <= r38759168;
        double r38759170 = r38759169 ? r38759156 : r38759167;
        double r38759171 = r38759166 ? r38759167 : r38759170;
        double r38759172 = r38759164 ? r38759156 : r38759171;
        double r38759173 = r38759158 ? r38759162 : r38759172;
        return r38759173;
}

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.6
Target2.8
Herbie1.5
\[\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) < -6.083035639847638e+292

    1. Initial program 57.7

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

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

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

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

    if -6.083035639847638e+292 < (/ (* x (- y z)) y) < -8.175248265444714e+123 or 4.597572249704838e+18 < (/ (* x (- y z)) y) < 1.0955456490722775e+260

    1. Initial program 0.2

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

    if -8.175248265444714e+123 < (/ (* x (- y z)) y) < 4.597572249704838e+18 or 1.0955456490722775e+260 < (/ (* x (- y z)) y)

    1. Initial program 11.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{\left(y - z\right) \cdot x}{y} \le -6.083035639847637607654497125773830646304 \cdot 10^{292}:\\ \;\;\;\;\frac{\frac{x}{\sqrt{\frac{y}{y - z}}}}{\sqrt{\frac{y}{y - z}}}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le -8.175248265444713739055182742884957439272 \cdot 10^{123}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{y}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le 4597572249704838144:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \mathbf{elif}\;\frac{\left(y - z\right) \cdot x}{y} \le 1.095545649072277509917652984108949902858 \cdot 10^{260}:\\ \;\;\;\;\frac{\left(y - z\right) \cdot x}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{y}{y - z}}\\ \end{array}\]

Reproduce

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