Average Error: 6.3 → 0.4
Time: 16.8s
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 r843093 = x;
        double r843094 = y;
        double r843095 = r843093 * r843094;
        double r843096 = z;
        double r843097 = r843095 / r843096;
        return r843097;
}

double f(double x, double y, double z) {
        double r843098 = x;
        double r843099 = y;
        double r843100 = r843098 * r843099;
        double r843101 = z;
        double r843102 = r843100 / r843101;
        double r843103 = -inf.0;
        bool r843104 = r843102 <= r843103;
        double r843105 = -2.5779739675514e-315;
        bool r843106 = r843102 <= r843105;
        double r843107 = 4.8887795655991e-320;
        bool r843108 = r843102 <= r843107;
        double r843109 = 6.479136316462784e+303;
        bool r843110 = r843102 <= r843109;
        double r843111 = !r843110;
        bool r843112 = r843108 || r843111;
        double r843113 = !r843112;
        bool r843114 = r843106 || r843113;
        double r843115 = !r843114;
        bool r843116 = r843104 || r843115;
        double r843117 = r843101 / r843099;
        double r843118 = r843098 / r843117;
        double r843119 = r843116 ? r843118 : r843102;
        return r843119;
}

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 +o rules:numerics
(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))