Average Error: 6.6 → 0.4
Time: 33.4s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot x \le -8.534245550996871115175132035540626568645 \cdot 10^{275}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;y \cdot x \le -3.472696779446323935386925227685759967005 \cdot 10^{-166}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;y \cdot x \le 2.024155232095970608846100533696018819805 \cdot 10^{-258}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;y \cdot x \le 2.475358399731635635401152366260838826524 \cdot 10^{251}:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;y \cdot x \le -8.534245550996871115175132035540626568645 \cdot 10^{275}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

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

\mathbf{elif}\;y \cdot x \le 2.475358399731635635401152366260838826524 \cdot 10^{251}:\\
\;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r31351811 = x;
        double r31351812 = y;
        double r31351813 = r31351811 * r31351812;
        double r31351814 = z;
        double r31351815 = r31351813 / r31351814;
        return r31351815;
}

double f(double x, double y, double z) {
        double r31351816 = y;
        double r31351817 = x;
        double r31351818 = r31351816 * r31351817;
        double r31351819 = -8.534245550996871e+275;
        bool r31351820 = r31351818 <= r31351819;
        double r31351821 = z;
        double r31351822 = r31351816 / r31351821;
        double r31351823 = r31351822 * r31351817;
        double r31351824 = -3.472696779446324e-166;
        bool r31351825 = r31351818 <= r31351824;
        double r31351826 = r31351818 / r31351821;
        double r31351827 = 2.0241552320959706e-258;
        bool r31351828 = r31351818 <= r31351827;
        double r31351829 = 2.4753583997316356e+251;
        bool r31351830 = r31351818 <= r31351829;
        double r31351831 = 1.0;
        double r31351832 = r31351831 / r31351821;
        double r31351833 = r31351832 * r31351818;
        double r31351834 = r31351821 / r31351816;
        double r31351835 = r31351817 / r31351834;
        double r31351836 = r31351830 ? r31351833 : r31351835;
        double r31351837 = r31351828 ? r31351823 : r31351836;
        double r31351838 = r31351825 ? r31351826 : r31351837;
        double r31351839 = r31351820 ? r31351823 : r31351838;
        return r31351839;
}

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.6
Target6.2
Herbie0.4
\[\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) < -8.534245550996871e+275 or -3.472696779446324e-166 < (* x y) < 2.0241552320959706e-258

    1. Initial program 15.9

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

      \[\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 -8.534245550996871e+275 < (* x y) < -3.472696779446324e-166

    1. Initial program 0.3

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

    if 2.0241552320959706e-258 < (* x y) < 2.4753583997316356e+251

    1. Initial program 0.2

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

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

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

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

      \[\leadsto x \cdot \frac{y}{\color{blue}{1 \cdot z}}\]
    8. Applied add-cube-cbrt9.4

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

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

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

      \[\leadsto \color{blue}{\left(\left(x \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    12. Using strategy rm
    13. Applied div-inv2.8

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

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

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

    if 2.4753583997316356e+251 < (* x y)

    1. Initial program 40.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot x \le -8.534245550996871115175132035540626568645 \cdot 10^{275}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;y \cdot x \le -3.472696779446323935386925227685759967005 \cdot 10^{-166}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{elif}\;y \cdot x \le 2.024155232095970608846100533696018819805 \cdot 10^{-258}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;y \cdot x \le 2.475358399731635635401152366260838826524 \cdot 10^{251}:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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

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

  (/ (* x y) z))