Average Error: 6.2 → 0.5
Time: 10.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 r534426 = x;
        double r534427 = y;
        double r534428 = r534426 * r534427;
        double r534429 = z;
        double r534430 = r534428 / r534429;
        return r534430;
}

double f(double x, double y, double z) {
        double r534431 = x;
        double r534432 = y;
        double r534433 = r534431 * r534432;
        double r534434 = -inf.0;
        bool r534435 = r534433 <= r534434;
        double r534436 = z;
        double r534437 = r534432 / r534436;
        double r534438 = r534431 * r534437;
        double r534439 = -8.83073573156853e-179;
        bool r534440 = r534433 <= r534439;
        double r534441 = 1.0;
        double r534442 = r534436 / r534433;
        double r534443 = r534441 / r534442;
        double r534444 = -0.0;
        bool r534445 = r534433 <= r534444;
        double r534446 = 4.105888948139835e+262;
        bool r534447 = r534433 <= r534446;
        double r534448 = r534433 / r534436;
        double r534449 = r534436 / r534431;
        double r534450 = r534441 / r534449;
        double r534451 = r534441 / r534432;
        double r534452 = r534450 / r534451;
        double r534453 = r534447 ? r534448 : r534452;
        double r534454 = r534445 ? r534438 : r534453;
        double r534455 = r534440 ? r534443 : r534454;
        double r534456 = r534435 ? r534438 : r534455;
        return r534456;
}

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 +o rules:numerics
(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))