Average Error: 6.2 → 1.1
Time: 8.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.7213465425126525 \cdot 10^{+172}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.4578769880757935 \cdot 10^{-115}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.3508925074839404 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 6.859366357865012 \cdot 10^{+120}:\\ \;\;\;\;\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 \le -1.7213465425126525 \cdot 10^{+172}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

\mathbf{elif}\;x \cdot y \le 6.859366357865012 \cdot 10^{+120}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r34998678 = x;
        double r34998679 = y;
        double r34998680 = r34998678 * r34998679;
        double r34998681 = z;
        double r34998682 = r34998680 / r34998681;
        return r34998682;
}

double f(double x, double y, double z) {
        double r34998683 = x;
        double r34998684 = y;
        double r34998685 = r34998683 * r34998684;
        double r34998686 = -1.7213465425126525e+172;
        bool r34998687 = r34998685 <= r34998686;
        double r34998688 = z;
        double r34998689 = r34998684 / r34998688;
        double r34998690 = r34998683 * r34998689;
        double r34998691 = -3.4578769880757935e-115;
        bool r34998692 = r34998685 <= r34998691;
        double r34998693 = r34998685 / r34998688;
        double r34998694 = 1.3508925074839404e-153;
        bool r34998695 = r34998685 <= r34998694;
        double r34998696 = 6.859366357865012e+120;
        bool r34998697 = r34998685 <= r34998696;
        double r34998698 = r34998683 / r34998688;
        double r34998699 = r34998698 * r34998684;
        double r34998700 = r34998697 ? r34998693 : r34998699;
        double r34998701 = r34998695 ? r34998690 : r34998700;
        double r34998702 = r34998692 ? r34998693 : r34998701;
        double r34998703 = r34998687 ? r34998690 : r34998702;
        return r34998703;
}

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.2
Target5.9
Herbie1.1
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519429 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.7042130660650472 \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) < -1.7213465425126525e+172 or -3.4578769880757935e-115 < (* x y) < 1.3508925074839404e-153

    1. Initial program 10.2

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

      \[\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}\]

    if -1.7213465425126525e+172 < (* x y) < -3.4578769880757935e-115 or 1.3508925074839404e-153 < (* x y) < 6.859366357865012e+120

    1. Initial program 0.2

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

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

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

      \[\leadsto \color{blue}{x} \cdot \frac{y}{z}\]
    6. Using strategy rm
    7. Applied associate-*r/0.2

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

    if 6.859366357865012e+120 < (* x y)

    1. Initial program 15.6

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.7213465425126525 \cdot 10^{+172}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.4578769880757935 \cdot 10^{-115}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.3508925074839404 \cdot 10^{-153}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 6.859366357865012 \cdot 10^{+120}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019163 
(FPCore (x y z)
  :name "Diagrams.Solve.Tridiagonal:solveCyclicTriDiagonal from diagrams-solve-0.1, A"

  :herbie-target
  (if (< z -4.262230790519429e-138) (/ (* x y) z) (if (< z 1.7042130660650472e-164) (/ x (/ z y)) (* (/ x z) y)))

  (/ (* x y) z))