Average Error: 6.0 → 1.7
Time: 1.5s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.4388707905139013 \cdot 10^{211} \lor \neg \left(x \cdot y \le -2.8697693066874046 \cdot 10^{-264} \lor \neg \left(x \cdot y \le 1.0101772655541281 \cdot 10^{-183}\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}\;x \cdot y \le -1.4388707905139013 \cdot 10^{211} \lor \neg \left(x \cdot y \le -2.8697693066874046 \cdot 10^{-264} \lor \neg \left(x \cdot y \le 1.0101772655541281 \cdot 10^{-183}\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 r725267 = x;
        double r725268 = y;
        double r725269 = r725267 * r725268;
        double r725270 = z;
        double r725271 = r725269 / r725270;
        return r725271;
}

double f(double x, double y, double z) {
        double r725272 = x;
        double r725273 = y;
        double r725274 = r725272 * r725273;
        double r725275 = -1.4388707905139013e+211;
        bool r725276 = r725274 <= r725275;
        double r725277 = -2.8697693066874046e-264;
        bool r725278 = r725274 <= r725277;
        double r725279 = 1.0101772655541281e-183;
        bool r725280 = r725274 <= r725279;
        double r725281 = !r725280;
        bool r725282 = r725278 || r725281;
        double r725283 = !r725282;
        bool r725284 = r725276 || r725283;
        double r725285 = z;
        double r725286 = r725285 / r725273;
        double r725287 = r725272 / r725286;
        double r725288 = r725274 / r725285;
        double r725289 = r725284 ? r725287 : r725288;
        return r725289;
}

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.0
Target6.4
Herbie1.7
\[\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) < -1.4388707905139013e+211 or -2.8697693066874046e-264 < (* x y) < 1.0101772655541281e-183

    1. Initial program 14.8

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

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

    if -1.4388707905139013e+211 < (* x y) < -2.8697693066874046e-264 or 1.0101772655541281e-183 < (* x y)

    1. Initial program 2.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.4388707905139013 \cdot 10^{211} \lor \neg \left(x \cdot y \le -2.8697693066874046 \cdot 10^{-264} \lor \neg \left(x \cdot y \le 1.0101772655541281 \cdot 10^{-183}\right)\right):\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020033 +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))