Average Error: 6.3 → 0.8
Time: 2.4s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -2.666618308604909 \cdot 10^{-248}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.291536027190061 \cdot 10^{-88}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.0802670635728964 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y = -\infty:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\mathbf{elif}\;x \cdot y \le -2.666618308604909 \cdot 10^{-248}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;x \cdot y \le 1.291536027190061 \cdot 10^{-88}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le 2.0802670635728964 \cdot 10^{198}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\end{array}
double f(double x, double y, double z) {
        double r717728 = x;
        double r717729 = y;
        double r717730 = r717728 * r717729;
        double r717731 = z;
        double r717732 = r717730 / r717731;
        return r717732;
}

double f(double x, double y, double z) {
        double r717733 = x;
        double r717734 = y;
        double r717735 = r717733 * r717734;
        double r717736 = -inf.0;
        bool r717737 = r717735 <= r717736;
        double r717738 = z;
        double r717739 = r717733 / r717738;
        double r717740 = r717739 * r717734;
        double r717741 = -2.666618308604909e-248;
        bool r717742 = r717735 <= r717741;
        double r717743 = r717735 / r717738;
        double r717744 = 1.291536027190061e-88;
        bool r717745 = r717735 <= r717744;
        double r717746 = r717734 / r717738;
        double r717747 = r717733 * r717746;
        double r717748 = 2.0802670635728964e+198;
        bool r717749 = r717735 <= r717748;
        double r717750 = r717749 ? r717743 : r717740;
        double r717751 = r717745 ? r717747 : r717750;
        double r717752 = r717742 ? r717743 : r717751;
        double r717753 = r717737 ? r717740 : r717752;
        return r717753;
}

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.0
Herbie0.8
\[\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 3 regimes
  2. if (* x y) < -inf.0 or 2.0802670635728964e+198 < (* x y)

    1. Initial program 38.5

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.9

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

    if -inf.0 < (* x y) < -2.666618308604909e-248 or 1.291536027190061e-88 < (* x y) < 2.0802670635728964e+198

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]

    if -2.666618308604909e-248 < (* x y) < 1.291536027190061e-88

    1. Initial program 8.6

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity8.6

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac1.6

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    5. Simplified1.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -2.666618308604909 \cdot 10^{-248}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.291536027190061 \cdot 10^{-88}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.0802670635728964 \cdot 10^{198}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

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