Average Error: 6.2 → 0.8
Time: 10.6s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -9.977639429899369989820721692045022376536 \cdot 10^{292} \lor \neg \left(x \cdot y \le -1.825173703048544803476102458184078598692 \cdot 10^{-96} \lor \neg \left(x \cdot y \le 2.361991935307828800783872424628048333578 \cdot 10^{-316}\right) \land x \cdot y \le 1.830819210750021062326979763016492837298 \cdot 10^{169}\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 -9.977639429899369989820721692045022376536 \cdot 10^{292} \lor \neg \left(x \cdot y \le -1.825173703048544803476102458184078598692 \cdot 10^{-96} \lor \neg \left(x \cdot y \le 2.361991935307828800783872424628048333578 \cdot 10^{-316}\right) \land x \cdot y \le 1.830819210750021062326979763016492837298 \cdot 10^{169}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z) {
        double r588608 = x;
        double r588609 = y;
        double r588610 = r588608 * r588609;
        double r588611 = z;
        double r588612 = r588610 / r588611;
        return r588612;
}

double f(double x, double y, double z) {
        double r588613 = x;
        double r588614 = y;
        double r588615 = r588613 * r588614;
        double r588616 = -9.97763942989937e+292;
        bool r588617 = r588615 <= r588616;
        double r588618 = -1.8251737030485448e-96;
        bool r588619 = r588615 <= r588618;
        double r588620 = 2.3619919353078e-316;
        bool r588621 = r588615 <= r588620;
        double r588622 = !r588621;
        double r588623 = 1.830819210750021e+169;
        bool r588624 = r588615 <= r588623;
        bool r588625 = r588622 && r588624;
        bool r588626 = r588619 || r588625;
        double r588627 = !r588626;
        bool r588628 = r588617 || r588627;
        double r588629 = z;
        double r588630 = r588629 / r588614;
        double r588631 = r588613 / r588630;
        double r588632 = r588615 / r588629;
        double r588633 = r588628 ? r588631 : r588632;
        return r588633;
}

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.2
Target6.2
Herbie0.8
\[\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) < -9.97763942989937e+292 or -1.8251737030485448e-96 < (* x y) < 2.3619919353078e-316 or 1.830819210750021e+169 < (* x y)

    1. Initial program 15.3

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

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

    if -9.97763942989937e+292 < (* x y) < -1.8251737030485448e-96 or 2.3619919353078e-316 < (* x y) < 1.830819210750021e+169

    1. Initial program 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -9.977639429899369989820721692045022376536 \cdot 10^{292} \lor \neg \left(x \cdot y \le -1.825173703048544803476102458184078598692 \cdot 10^{-96} \lor \neg \left(x \cdot y \le 2.361991935307828800783872424628048333578 \cdot 10^{-316}\right) \land x \cdot y \le 1.830819210750021062326979763016492837298 \cdot 10^{169}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019194 +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))