Average Error: 6.2 → 0.3
Time: 2.4s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \le -2.51049094085501509 \cdot 10^{-305}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.3541375655288775 \cdot 10^{-189}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.53196629214848261 \cdot 10^{186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\

\mathbf{elif}\;x \cdot y \le -2.51049094085501509 \cdot 10^{-305}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;x \cdot y \le 2.3541375655288775 \cdot 10^{-189}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{elif}\;x \cdot y \le 3.53196629214848261 \cdot 10^{186}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r834686 = x;
        double r834687 = y;
        double r834688 = r834686 * r834687;
        double r834689 = z;
        double r834690 = r834688 / r834689;
        return r834690;
}

double f(double x, double y, double z) {
        double r834691 = x;
        double r834692 = y;
        double r834693 = r834691 * r834692;
        double r834694 = -inf.0;
        bool r834695 = r834693 <= r834694;
        double r834696 = 1.0;
        double r834697 = z;
        double r834698 = r834697 / r834692;
        double r834699 = r834698 / r834691;
        double r834700 = r834696 / r834699;
        double r834701 = -2.510490940855015e-305;
        bool r834702 = r834693 <= r834701;
        double r834703 = r834693 / r834697;
        double r834704 = 2.3541375655288775e-189;
        bool r834705 = r834693 <= r834704;
        double r834706 = r834691 / r834698;
        double r834707 = 3.5319662921484826e+186;
        bool r834708 = r834693 <= r834707;
        double r834709 = r834708 ? r834703 : r834700;
        double r834710 = r834705 ? r834706 : r834709;
        double r834711 = r834702 ? r834703 : r834710;
        double r834712 = r834695 ? r834700 : r834711;
        return r834712;
}

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.3
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.70421306606504721 \cdot 10^{-164}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if (* x y) < -inf.0 or 3.5319662921484826e+186 < (* x y)

    1. Initial program 33.2

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied clear-num1.2

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

    if -inf.0 < (* x y) < -2.510490940855015e-305 or 2.3541375655288775e-189 < (* x y) < 3.5319662921484826e+186

    1. Initial program 0.2

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

    if -2.510490940855015e-305 < (* x y) < 2.3541375655288775e-189

    1. Initial program 13.1

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \mathbf{elif}\;x \cdot y \le -2.51049094085501509 \cdot 10^{-305}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.3541375655288775 \cdot 10^{-189}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 3.53196629214848261 \cdot 10^{186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{y}}{x}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020062 
(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.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))