Average Error: 6.0 → 0.4
Time: 1.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} \lor \neg \left(x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right)\right)\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} \lor \neg \left(x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right)\right)\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r637583 = x;
        double r637584 = y;
        double r637585 = r637583 * r637584;
        double r637586 = z;
        double r637587 = r637585 / r637586;
        return r637587;
}

double f(double x, double y, double z) {
        double r637588 = x;
        double r637589 = y;
        double r637590 = r637588 * r637589;
        double r637591 = -5.390377895817918e+281;
        bool r637592 = r637590 <= r637591;
        double r637593 = -4.2986870610872676e-207;
        bool r637594 = r637590 <= r637593;
        double r637595 = 2.4098315974795416e-281;
        bool r637596 = r637590 <= r637595;
        double r637597 = 1.6360485905719336e+179;
        bool r637598 = r637590 <= r637597;
        double r637599 = !r637598;
        bool r637600 = r637596 || r637599;
        double r637601 = !r637600;
        bool r637602 = r637594 || r637601;
        double r637603 = !r637602;
        bool r637604 = r637592 || r637603;
        double r637605 = z;
        double r637606 = r637605 / r637589;
        double r637607 = r637588 / r637606;
        double r637608 = r637590 / r637605;
        double r637609 = r637604 ? r637607 : r637608;
        return r637609;
}

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} \lor \neg \left(x \cdot y \le 1.63604859057193362863482232436108847646 \cdot 10^{179}\right)\right)\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.70421306606504721e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))