Average Error: 6.3 → 0.4
Time: 15.7s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty \lor \neg \left(\frac{x \cdot y}{z} \le -2.577973968 \cdot 10^{-315} \lor \neg \left(\frac{x \cdot y}{z} \le 4.88878 \cdot 10^{-320} \lor \neg \left(\frac{x \cdot y}{z} \le 6.4791363164627841 \cdot 10^{303}\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}\;\frac{x \cdot y}{z} = -\infty \lor \neg \left(\frac{x \cdot y}{z} \le -2.577973968 \cdot 10^{-315} \lor \neg \left(\frac{x \cdot y}{z} \le 4.88878 \cdot 10^{-320} \lor \neg \left(\frac{x \cdot y}{z} \le 6.4791363164627841 \cdot 10^{303}\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 r789943 = x;
        double r789944 = y;
        double r789945 = r789943 * r789944;
        double r789946 = z;
        double r789947 = r789945 / r789946;
        return r789947;
}

double f(double x, double y, double z) {
        double r789948 = x;
        double r789949 = y;
        double r789950 = r789948 * r789949;
        double r789951 = z;
        double r789952 = r789950 / r789951;
        double r789953 = -inf.0;
        bool r789954 = r789952 <= r789953;
        double r789955 = -2.5779739675514e-315;
        bool r789956 = r789952 <= r789955;
        double r789957 = 4.8887795655991e-320;
        bool r789958 = r789952 <= r789957;
        double r789959 = 6.479136316462784e+303;
        bool r789960 = r789952 <= r789959;
        double r789961 = !r789960;
        bool r789962 = r789958 || r789961;
        double r789963 = !r789962;
        bool r789964 = r789956 || r789963;
        double r789965 = !r789964;
        bool r789966 = r789954 || r789965;
        double r789967 = r789951 / r789949;
        double r789968 = r789948 / r789967;
        double r789969 = r789966 ? r789968 : r789952;
        return r789969;
}

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.3
Target6.1
Herbie0.4
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.70421306606504721 \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) z) < -inf.0 or -2.5779739675514e-315 < (/ (* x y) z) < 4.8887795655991e-320 or 6.479136316462784e+303 < (/ (* x y) z)

    1. Initial program 20.5

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

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

    if -inf.0 < (/ (* x y) z) < -2.5779739675514e-315 or 4.8887795655991e-320 < (/ (* x y) z) < 6.479136316462784e+303

    1. Initial program 0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} = -\infty \lor \neg \left(\frac{x \cdot y}{z} \le -2.577973968 \cdot 10^{-315} \lor \neg \left(\frac{x \cdot y}{z} \le 4.88878 \cdot 10^{-320} \lor \neg \left(\frac{x \cdot y}{z} \le 6.4791363164627841 \cdot 10^{303}\right)\right)\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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