Average Error: 6.1 → 1.0
Time: 15.7s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211} \lor \neg \left(x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196} \lor \neg \left(x \cdot y \le -0.0\right) \land x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211} \lor \neg \left(x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196} \lor \neg \left(x \cdot y \le -0.0\right) \land x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}\right):\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{else}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\end{array}
double f(double x, double y, double z) {
        double r597320 = x;
        double r597321 = y;
        double r597322 = r597320 * r597321;
        double r597323 = z;
        double r597324 = r597322 / r597323;
        return r597324;
}

double f(double x, double y, double z) {
        double r597325 = x;
        double r597326 = y;
        double r597327 = r597325 * r597326;
        double r597328 = -3.215556071613413e+211;
        bool r597329 = r597327 <= r597328;
        double r597330 = -8.160507073987473e-196;
        bool r597331 = r597327 <= r597330;
        double r597332 = -0.0;
        bool r597333 = r597327 <= r597332;
        double r597334 = !r597333;
        double r597335 = 3.6746036018542087e+86;
        bool r597336 = r597327 <= r597335;
        bool r597337 = r597334 && r597336;
        bool r597338 = r597331 || r597337;
        double r597339 = !r597338;
        bool r597340 = r597329 || r597339;
        double r597341 = z;
        double r597342 = r597341 / r597326;
        double r597343 = r597325 / r597342;
        double r597344 = 1.0;
        double r597345 = r597344 / r597341;
        double r597346 = r597327 * r597345;
        double r597347 = r597340 ? r597343 : r597346;
        return r597347;
}

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.1
Target6.4
Herbie1.0
\[\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) < -3.215556071613413e+211 or -8.160507073987473e-196 < (* x y) < -0.0 or 3.6746036018542087e+86 < (* x y)

    1. Initial program 14.7

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

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

    if -3.215556071613413e+211 < (* x y) < -8.160507073987473e-196 or -0.0 < (* x y) < 3.6746036018542087e+86

    1. Initial program 2.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied div-inv2.3

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.215556071613412899309254113303266622928 \cdot 10^{211} \lor \neg \left(x \cdot y \le -8.160507073987472840955517624398211725717 \cdot 10^{-196} \lor \neg \left(x \cdot y \le -0.0\right) \land x \cdot y \le 3.674603601854208702851027640434707440909 \cdot 10^{86}\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \end{array}\]

Reproduce

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