Average Error: 6.5 → 0.7
Time: 2.4s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\ \;\;\;\;1 \cdot \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:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 3.90915317948964794762777056224645120804 \cdot 10^{266}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\
\;\;\;\;1 \cdot \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:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

\end{array}
double f(double x, double y, double z) {
        double r591769 = x;
        double r591770 = y;
        double r591771 = r591769 * r591770;
        double r591772 = z;
        double r591773 = r591771 / r591772;
        return r591773;
}

double f(double x, double y, double z) {
        double r591774 = x;
        double r591775 = y;
        double r591776 = r591774 * r591775;
        double r591777 = z;
        double r591778 = r591776 / r591777;
        double r591779 = -inf.0;
        bool r591780 = r591778 <= r591779;
        double r591781 = 1.0;
        double r591782 = r591777 / r591775;
        double r591783 = r591774 / r591782;
        double r591784 = r591781 * r591783;
        double r591785 = -2.7540332723157e-316;
        bool r591786 = r591778 <= r591785;
        double r591787 = r591781 * r591778;
        double r591788 = 0.0;
        bool r591789 = r591778 <= r591788;
        double r591790 = r591775 / r591777;
        double r591791 = r591774 * r591790;
        double r591792 = 3.909153179489648e+266;
        bool r591793 = r591778 <= r591792;
        double r591794 = r591793 ? r591787 : r591791;
        double r591795 = r591789 ? r591791 : r591794;
        double r591796 = r591786 ? r591787 : r591795;
        double r591797 = r591780 ? r591784 : r591796;
        return r591797;
}

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 add-cube-cbrt64.0

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

      \[\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-identity1.3

      \[\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*1.3

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

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot y}{z}}\]
    9. Using strategy rm
    10. Applied associate-/l*0.2

      \[\leadsto 1 \cdot \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 *-un-lft-identity18.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty:\\ \;\;\;\;1 \cdot \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:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le 3.90915317948964794762777056224645120804 \cdot 10^{266}:\\ \;\;\;\;1 \cdot \frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \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))