Average Error: 6.5 → 0.7
Time: 2.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -2.75403327231568085421125185005337842666 \cdot 10^{-316}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 0.0:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 3.90915317948964794762777056224645120804 \cdot 10^{266}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{y}{z}\right)\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\mathbf{elif}\;\frac{x \cdot y}{z} \le 0.0:\\
\;\;\;\;1 \cdot \left(x \cdot \frac{y}{z}\right)\\

\mathbf{elif}\;\frac{x \cdot y}{z} \le 3.90915317948964794762777056224645120804 \cdot 10^{266}:\\
\;\;\;\;1 \cdot \frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r666685 = x;
        double r666686 = y;
        double r666687 = r666685 * r666686;
        double r666688 = z;
        double r666689 = r666687 / r666688;
        return r666689;
}

double f(double x, double y, double z) {
        double r666690 = x;
        double r666691 = y;
        double r666692 = r666690 * r666691;
        double r666693 = z;
        double r666694 = r666692 / r666693;
        double r666695 = -inf.0;
        bool r666696 = r666694 <= r666695;
        double r666697 = r666693 / r666691;
        double r666698 = r666690 / r666697;
        double r666699 = -2.7540332723157e-316;
        bool r666700 = r666694 <= r666699;
        double r666701 = 1.0;
        double r666702 = r666701 * r666694;
        double r666703 = 0.0;
        bool r666704 = r666694 <= r666703;
        double r666705 = r666691 / r666693;
        double r666706 = r666690 * r666705;
        double r666707 = r666701 * r666706;
        double r666708 = 3.909153179489648e+266;
        bool r666709 = r666694 <= r666708;
        double r666710 = r666709 ? r666702 : r666707;
        double r666711 = r666704 ? r666707 : r666710;
        double r666712 = r666700 ? r666702 : r666711;
        double r666713 = r666696 ? r666698 : r666712;
        return r666713;
}

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.5
Target6.5
Herbie0.7
\[\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 3 regimes
  2. if (/ (* x y) z) < -inf.0

    1. Initial program 64.0

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

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

    if -inf.0 < (/ (* x y) z) < -2.7540332723157e-316 or 0.0 < (/ (* x y) z) < 3.909153179489648e+266

    1. Initial program 2.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt3.2

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied times-frac6.4

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity6.4

      \[\leadsto \color{blue}{\left(1 \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right)} \cdot \frac{y}{\sqrt[3]{z}}\]
    7. Applied associate-*l*6.4

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)}\]
    8. Simplified2.2

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

    if -2.7540332723157e-316 < (/ (* x y) z) < 0.0 or 3.909153179489648e+266 < (/ (* x y) z)

    1. Initial program 18.8

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt18.9

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied times-frac2.1

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity2.1

      \[\leadsto \color{blue}{\left(1 \cdot \frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right)} \cdot \frac{y}{\sqrt[3]{z}}\]
    7. Applied associate-*l*2.1

      \[\leadsto \color{blue}{1 \cdot \left(\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)}\]
    8. Simplified18.8

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot y}{z}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity18.8

      \[\leadsto 1 \cdot \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    11. Applied times-frac2.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -2.75403327231568085421125185005337842666 \cdot 10^{-316}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 0.0:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{y}{z}\right)\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 3.90915317948964794762777056224645120804 \cdot 10^{266}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(x \cdot \frac{y}{z}\right)\\ \end{array}\]

Reproduce

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

  (/ (* x y) z))