Average Error: 6.6 → 0.4
Time: 24.1s
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 r34525128 = x;
        double r34525129 = y;
        double r34525130 = r34525128 * r34525129;
        double r34525131 = z;
        double r34525132 = r34525130 / r34525131;
        return r34525132;
}

double f(double x, double y, double z) {
        double r34525133 = y;
        double r34525134 = x;
        double r34525135 = r34525133 * r34525134;
        double r34525136 = -8.534245550996871e+275;
        bool r34525137 = r34525135 <= r34525136;
        double r34525138 = z;
        double r34525139 = r34525133 / r34525138;
        double r34525140 = r34525139 * r34525134;
        double r34525141 = -3.472696779446324e-166;
        bool r34525142 = r34525135 <= r34525141;
        double r34525143 = r34525135 / r34525138;
        double r34525144 = 2.0241552320959706e-258;
        bool r34525145 = r34525135 <= r34525144;
        double r34525146 = 2.4753583997316356e+251;
        bool r34525147 = r34525135 <= r34525146;
        double r34525148 = 1.0;
        double r34525149 = r34525148 / r34525138;
        double r34525150 = r34525149 * r34525135;
        double r34525151 = r34525138 / r34525133;
        double r34525152 = r34525134 / r34525151;
        double r34525153 = r34525147 ? r34525150 : r34525152;
        double r34525154 = r34525145 ? r34525140 : r34525153;
        double r34525155 = r34525142 ? r34525143 : r34525154;
        double r34525156 = r34525137 ? r34525140 : r34525155;
        return r34525156;
}

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(\sqrt[3]{y} \cdot x\right) \cdot \sqrt[3]{y}\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    12. Using strategy rm
    13. Applied div-inv2.8

      \[\leadsto \left(\left(\sqrt[3]{y} \cdot x\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(\sqrt[3]{y} \cdot x\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 +o rules:numerics
(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))