Average Error: 6.0 → 0.4
Time: 14.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -5.390377895817917772419668299668841422542 \cdot 10^{281} \lor \neg \left(x \cdot y \le -4.298687061087267567138297560273868903463 \cdot 10^{-207} \lor \neg \left(x \cdot y \le 2.409831597479541575498163389776208009711 \cdot 10^{-281}\right) \land x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -5.390377895817917772419668299668841422542 \cdot 10^{281} \lor \neg \left(x \cdot y \le -4.298687061087267567138297560273868903463 \cdot 10^{-207} \lor \neg \left(x \cdot y \le 2.409831597479541575498163389776208009711 \cdot 10^{-281}\right) \land x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r471998 = x;
        double r471999 = y;
        double r472000 = r471998 * r471999;
        double r472001 = z;
        double r472002 = r472000 / r472001;
        return r472002;
}

double f(double x, double y, double z) {
        double r472003 = x;
        double r472004 = y;
        double r472005 = r472003 * r472004;
        double r472006 = -5.390377895817918e+281;
        bool r472007 = r472005 <= r472006;
        double r472008 = -4.2986870610872676e-207;
        bool r472009 = r472005 <= r472008;
        double r472010 = 2.4098315974795416e-281;
        bool r472011 = r472005 <= r472010;
        double r472012 = !r472011;
        double r472013 = 1.6360485905719336e+179;
        bool r472014 = r472005 <= r472013;
        bool r472015 = r472012 && r472014;
        bool r472016 = r472009 || r472015;
        double r472017 = !r472016;
        bool r472018 = r472007 || r472017;
        double r472019 = z;
        double r472020 = r472019 / r472004;
        double r472021 = r472003 / r472020;
        double r472022 = r472005 / r472019;
        double r472023 = r472018 ? r472021 : r472022;
        return r472023;
}

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.0
Target6.5
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 2 regimes
  2. if (* x y) < -5.390377895817918e+281 or -4.2986870610872676e-207 < (* x y) < 2.4098315974795416e-281 or 1.6360485905719336e+179 < (* x y)

    1. Initial program 18.5

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num18.8

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

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

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

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

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{z}{x \cdot y}}\]
    9. Simplified18.5

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

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

    if -5.390377895817918e+281 < (* x y) < -4.2986870610872676e-207 or 2.4098315974795416e-281 < (* x y) < 1.6360485905719336e+179

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.6

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

      \[\leadsto \frac{1}{\color{blue}{1 \cdot \frac{z}{x \cdot y}}}\]
    6. Applied add-cube-cbrt0.6

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{\frac{z}{x \cdot y}}}\]
    8. Simplified0.6

      \[\leadsto \color{blue}{1} \cdot \frac{\sqrt[3]{1}}{\frac{z}{x \cdot y}}\]
    9. Simplified0.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -5.390377895817917772419668299668841422542 \cdot 10^{281} \lor \neg \left(x \cdot y \le -4.298687061087267567138297560273868903463 \cdot 10^{-207} \lor \neg \left(x \cdot y \le 2.409831597479541575498163389776208009711 \cdot 10^{-281}\right) \land x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019322 
(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))