Average Error: 6.2 → 0.5
Time: 9.5s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.830735731568530122686813681294776173598 \cdot 10^{-179}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 4.105888948139835055715561985182230190785 \cdot 10^{262}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{x}}}{\frac{1}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\mathbf{elif}\;x \cdot y \le -0.0:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le 4.105888948139835055715561985182230190785 \cdot 10^{262}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r561043 = x;
        double r561044 = y;
        double r561045 = r561043 * r561044;
        double r561046 = z;
        double r561047 = r561045 / r561046;
        return r561047;
}

double f(double x, double y, double z) {
        double r561048 = x;
        double r561049 = y;
        double r561050 = r561048 * r561049;
        double r561051 = -inf.0;
        bool r561052 = r561050 <= r561051;
        double r561053 = z;
        double r561054 = r561049 / r561053;
        double r561055 = r561048 * r561054;
        double r561056 = -8.83073573156853e-179;
        bool r561057 = r561050 <= r561056;
        double r561058 = 1.0;
        double r561059 = r561053 / r561050;
        double r561060 = r561058 / r561059;
        double r561061 = -0.0;
        bool r561062 = r561050 <= r561061;
        double r561063 = 4.105888948139835e+262;
        bool r561064 = r561050 <= r561063;
        double r561065 = r561050 / r561053;
        double r561066 = r561053 / r561048;
        double r561067 = r561058 / r561066;
        double r561068 = r561058 / r561049;
        double r561069 = r561067 / r561068;
        double r561070 = r561064 ? r561065 : r561069;
        double r561071 = r561062 ? r561055 : r561070;
        double r561072 = r561057 ? r561060 : r561071;
        double r561073 = r561052 ? r561055 : r561072;
        return r561073;
}

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

Original6.2
Target6.2
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519428958560619200129306371776 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.704213066065047207696571404603247573308 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (* x y) < -inf.0 or -8.83073573156853e-179 < (* x y) < -0.0

    1. Initial program 16.7

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity16.7

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

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

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

    if -inf.0 < (* x y) < -8.83073573156853e-179

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.6

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

    if -0.0 < (* x y) < 4.105888948139835e+262

    1. Initial program 3.4

      \[\frac{x \cdot y}{z}\]

    if 4.105888948139835e+262 < (* x y)

    1. Initial program 43.1

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num43.1

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.4

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -8.830735731568530122686813681294776173598 \cdot 10^{-179}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 4.105888948139835055715561985182230190785 \cdot 10^{262}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{\frac{z}{x}}}{\frac{1}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019235 
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"
  :precision binary64

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.70421306606504721e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))