Average Error: 6.2 → 0.8
Time: 10.7s
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 r592960 = x;
        double r592961 = y;
        double r592962 = r592960 * r592961;
        double r592963 = z;
        double r592964 = r592962 / r592963;
        return r592964;
}

double f(double x, double y, double z) {
        double r592965 = x;
        double r592966 = y;
        double r592967 = r592965 * r592966;
        double r592968 = -9.97763942989937e+292;
        bool r592969 = r592967 <= r592968;
        double r592970 = -1.8251737030485448e-96;
        bool r592971 = r592967 <= r592970;
        double r592972 = 2.3619919353078e-316;
        bool r592973 = r592967 <= r592972;
        double r592974 = !r592973;
        double r592975 = 1.830819210750021e+169;
        bool r592976 = r592967 <= r592975;
        bool r592977 = r592974 && r592976;
        bool r592978 = r592971 || r592977;
        double r592979 = !r592978;
        bool r592980 = r592969 || r592979;
        double r592981 = z;
        double r592982 = r592981 / r592966;
        double r592983 = r592965 / r592982;
        double r592984 = r592967 / r592981;
        double r592985 = r592980 ? r592983 : r592984;
        return r592985;
}

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 
(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))