Average Error: 6.2 → 0.8
Time: 10.9s
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 r624268 = x;
        double r624269 = y;
        double r624270 = r624268 * r624269;
        double r624271 = z;
        double r624272 = r624270 / r624271;
        return r624272;
}

double f(double x, double y, double z) {
        double r624273 = x;
        double r624274 = y;
        double r624275 = r624273 * r624274;
        double r624276 = -9.97763942989937e+292;
        bool r624277 = r624275 <= r624276;
        double r624278 = -1.8251737030485448e-96;
        bool r624279 = r624275 <= r624278;
        double r624280 = 2.3619919353078e-316;
        bool r624281 = r624275 <= r624280;
        double r624282 = !r624281;
        double r624283 = 1.830819210750021e+169;
        bool r624284 = r624275 <= r624283;
        bool r624285 = r624282 && r624284;
        bool r624286 = r624279 || r624285;
        double r624287 = !r624286;
        bool r624288 = r624277 || r624287;
        double r624289 = z;
        double r624290 = r624289 / r624274;
        double r624291 = r624273 / r624290;
        double r624292 = r624275 / r624289;
        double r624293 = r624288 ? r624291 : r624292;
        return r624293;
}

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