Average Error: 2.4 → 0.3
Time: 8.5s
Precision: 64
\[\frac{x}{\frac{x - y}{z - 1}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x}{\frac{x - y}{z - 1}} \le -1.379278451712667659718114517299172145797 \cdot 10^{222}:\\ \;\;\;\;\frac{1}{\frac{x - y}{x}} \cdot \left(z - 1\right)\\ \mathbf{elif}\;\frac{x}{\frac{x - y}{z - 1}} \le 2.766696205734764351590457830009568182363 \cdot 10^{-107}:\\ \;\;\;\;\frac{x}{\frac{x - y}{z - 1}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{x - y} + \left(-1\right) \cdot \frac{x}{x - y}\\ \end{array}\]
\frac{x}{\frac{x - y}{z - 1}}
\begin{array}{l}
\mathbf{if}\;\frac{x}{\frac{x - y}{z - 1}} \le -1.379278451712667659718114517299172145797 \cdot 10^{222}:\\
\;\;\;\;\frac{1}{\frac{x - y}{x}} \cdot \left(z - 1\right)\\

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

\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{x - y} + \left(-1\right) \cdot \frac{x}{x - y}\\

\end{array}
double f(double x, double y, double z) {
        double r638208 = x;
        double r638209 = y;
        double r638210 = r638208 - r638209;
        double r638211 = z;
        double r638212 = 1.0;
        double r638213 = r638211 - r638212;
        double r638214 = r638210 / r638213;
        double r638215 = r638208 / r638214;
        return r638215;
}

double f(double x, double y, double z) {
        double r638216 = x;
        double r638217 = y;
        double r638218 = r638216 - r638217;
        double r638219 = z;
        double r638220 = 1.0;
        double r638221 = r638219 - r638220;
        double r638222 = r638218 / r638221;
        double r638223 = r638216 / r638222;
        double r638224 = -1.3792784517126677e+222;
        bool r638225 = r638223 <= r638224;
        double r638226 = 1.0;
        double r638227 = r638218 / r638216;
        double r638228 = r638226 / r638227;
        double r638229 = r638228 * r638221;
        double r638230 = 2.7666962057347644e-107;
        bool r638231 = r638223 <= r638230;
        double r638232 = r638216 / r638218;
        double r638233 = r638219 * r638232;
        double r638234 = -r638220;
        double r638235 = r638234 * r638232;
        double r638236 = r638233 + r638235;
        double r638237 = r638231 ? r638223 : r638236;
        double r638238 = r638225 ? r638229 : r638237;
        return r638238;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (/ x (/ (- x y) (- z 1.0))) < -1.3792784517126677e+222

    1. Initial program 21.8

      \[\frac{x}{\frac{x - y}{z - 1}}\]
    2. Using strategy rm
    3. Applied associate-/r/0.1

      \[\leadsto \color{blue}{\frac{x}{x - y} \cdot \left(z - 1\right)}\]
    4. Using strategy rm
    5. Applied clear-num0.1

      \[\leadsto \color{blue}{\frac{1}{\frac{x - y}{x}}} \cdot \left(z - 1\right)\]

    if -1.3792784517126677e+222 < (/ x (/ (- x y) (- z 1.0))) < 2.7666962057347644e-107

    1. Initial program 0.1

      \[\frac{x}{\frac{x - y}{z - 1}}\]

    if 2.7666962057347644e-107 < (/ x (/ (- x y) (- z 1.0)))

    1. Initial program 5.1

      \[\frac{x}{\frac{x - y}{z - 1}}\]
    2. Using strategy rm
    3. Applied associate-/r/0.9

      \[\leadsto \color{blue}{\frac{x}{x - y} \cdot \left(z - 1\right)}\]
    4. Using strategy rm
    5. Applied sub-neg0.9

      \[\leadsto \frac{x}{x - y} \cdot \color{blue}{\left(z + \left(-1\right)\right)}\]
    6. Applied distribute-lft-in0.9

      \[\leadsto \color{blue}{\frac{x}{x - y} \cdot z + \frac{x}{x - y} \cdot \left(-1\right)}\]
    7. Simplified0.9

      \[\leadsto \color{blue}{z \cdot \frac{x}{x - y}} + \frac{x}{x - y} \cdot \left(-1\right)\]
    8. Simplified0.9

      \[\leadsto z \cdot \frac{x}{x - y} + \color{blue}{\left(-1\right) \cdot \frac{x}{x - y}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x}{\frac{x - y}{z - 1}} \le -1.379278451712667659718114517299172145797 \cdot 10^{222}:\\ \;\;\;\;\frac{1}{\frac{x - y}{x}} \cdot \left(z - 1\right)\\ \mathbf{elif}\;\frac{x}{\frac{x - y}{z - 1}} \le 2.766696205734764351590457830009568182363 \cdot 10^{-107}:\\ \;\;\;\;\frac{x}{\frac{x - y}{z - 1}}\\ \mathbf{else}:\\ \;\;\;\;z \cdot \frac{x}{x - y} + \left(-1\right) \cdot \frac{x}{x - y}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x y z)
  :name "x / ((x - y) / (z - 1))"
  :precision binary64
  (/ x (/ (- x y) (- z 1))))