Average Error: 12.6 → 1.5
Time: 26.9s
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 r34868138 = x;
        double r34868139 = y;
        double r34868140 = z;
        double r34868141 = r34868139 - r34868140;
        double r34868142 = r34868138 * r34868141;
        double r34868143 = r34868142 / r34868139;
        return r34868143;
}

double f(double x, double y, double z) {
        double r34868144 = y;
        double r34868145 = z;
        double r34868146 = r34868144 - r34868145;
        double r34868147 = x;
        double r34868148 = r34868146 * r34868147;
        double r34868149 = r34868148 / r34868144;
        double r34868150 = -6.083035639847638e+292;
        bool r34868151 = r34868149 <= r34868150;
        double r34868152 = r34868144 / r34868146;
        double r34868153 = sqrt(r34868152);
        double r34868154 = r34868147 / r34868153;
        double r34868155 = r34868154 / r34868153;
        double r34868156 = -8.175248265444714e+123;
        bool r34868157 = r34868149 <= r34868156;
        double r34868158 = 4.597572249704838e+18;
        bool r34868159 = r34868149 <= r34868158;
        double r34868160 = r34868147 / r34868152;
        double r34868161 = 1.0955456490722775e+260;
        bool r34868162 = r34868149 <= r34868161;
        double r34868163 = r34868162 ? r34868149 : r34868160;
        double r34868164 = r34868159 ? r34868160 : r34868163;
        double r34868165 = r34868157 ? r34868149 : r34868164;
        double r34868166 = r34868151 ? r34868155 : r34868165;
        return r34868166;
}

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