Average Error: 6.3 → 0.8
Time: 1.9s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -7.725807749934587 \cdot 10^{96}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -3.0807367441454416 \cdot 10^{-282}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.31151602867187701 \cdot 10^{255}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{x}{\frac{z}{y}}}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -7.725807749934587 \cdot 10^{96}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

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

\mathbf{elif}\;x \cdot y \le -0.0:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le 5.31151602867187701 \cdot 10^{255}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r758741 = x;
        double r758742 = y;
        double r758743 = r758741 * r758742;
        double r758744 = z;
        double r758745 = r758743 / r758744;
        return r758745;
}

double f(double x, double y, double z) {
        double r758746 = x;
        double r758747 = y;
        double r758748 = r758746 * r758747;
        double r758749 = -7.725807749934587e+96;
        bool r758750 = r758748 <= r758749;
        double r758751 = z;
        double r758752 = r758746 / r758751;
        double r758753 = r758752 * r758747;
        double r758754 = -3.0807367441454416e-282;
        bool r758755 = r758748 <= r758754;
        double r758756 = r758748 / r758751;
        double r758757 = -0.0;
        bool r758758 = r758748 <= r758757;
        double r758759 = r758747 / r758751;
        double r758760 = r758746 * r758759;
        double r758761 = 5.311516028671877e+255;
        bool r758762 = r758748 <= r758761;
        double r758763 = 1.0;
        double r758764 = r758751 / r758747;
        double r758765 = r758746 / r758764;
        double r758766 = r758763 / r758765;
        double r758767 = r758763 / r758766;
        double r758768 = r758762 ? r758756 : r758767;
        double r758769 = r758758 ? r758760 : r758768;
        double r758770 = r758755 ? r758756 : r758769;
        double r758771 = r758750 ? r758753 : r758770;
        return r758771;
}

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.4
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 4 regimes
  2. if (* x y) < -7.725807749934587e+96

    1. Initial program 14.6

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

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

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

    if -7.725807749934587e+96 < (* x y) < -3.0807367441454416e-282 or -0.0 < (* x y) < 5.311516028671877e+255

    1. Initial program 0.4

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

    if -3.0807367441454416e-282 < (* x y) < -0.0

    1. Initial program 17.6

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

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

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

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

    if 5.311516028671877e+255 < (* x y)

    1. Initial program 40.0

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied clear-num0.3

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y}}{x}}}\]
    6. Using strategy rm
    7. Applied clear-num0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -7.725807749934587 \cdot 10^{96}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -3.0807367441454416 \cdot 10^{-282}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le -0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.31151602867187701 \cdot 10^{255}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{1}{\frac{x}{\frac{z}{y}}}}\\ \end{array}\]

Reproduce

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