Average Error: 6.5 → 0.7
Time: 13.0s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.7422477441071717 \cdot 10^{287}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -4.10429083584695144 \cdot 10^{-162} \lor \neg \left(x \cdot y \le 3.3281391811522597 \cdot 10^{-203}\right) \land x \cdot y \le 1.32202209694643531 \cdot 10^{136}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -3.7422477441071717 \cdot 10^{287}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\mathbf{elif}\;x \cdot y \le -4.10429083584695144 \cdot 10^{-162} \lor \neg \left(x \cdot y \le 3.3281391811522597 \cdot 10^{-203}\right) \land x \cdot y \le 1.32202209694643531 \cdot 10^{136}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r520915 = x;
        double r520916 = y;
        double r520917 = r520915 * r520916;
        double r520918 = z;
        double r520919 = r520917 / r520918;
        return r520919;
}

double f(double x, double y, double z) {
        double r520920 = x;
        double r520921 = y;
        double r520922 = r520920 * r520921;
        double r520923 = -3.742247744107172e+287;
        bool r520924 = r520922 <= r520923;
        double r520925 = z;
        double r520926 = r520920 / r520925;
        double r520927 = r520926 * r520921;
        double r520928 = -4.1042908358469514e-162;
        bool r520929 = r520922 <= r520928;
        double r520930 = 3.32813918115226e-203;
        bool r520931 = r520922 <= r520930;
        double r520932 = !r520931;
        double r520933 = 1.3220220969464353e+136;
        bool r520934 = r520922 <= r520933;
        bool r520935 = r520932 && r520934;
        bool r520936 = r520929 || r520935;
        double r520937 = r520922 / r520925;
        double r520938 = r520925 / r520921;
        double r520939 = r520920 / r520938;
        double r520940 = r520936 ? r520937 : r520939;
        double r520941 = r520924 ? r520927 : r520940;
        return r520941;
}

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.5
Target6.3
Herbie0.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 3 regimes
  2. if (* x y) < -3.742247744107172e+287

    1. Initial program 54.3

      \[\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 associate-/r/0.3

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

    if -3.742247744107172e+287 < (* x y) < -4.1042908358469514e-162 or 3.32813918115226e-203 < (* x y) < 1.3220220969464353e+136

    1. Initial program 0.2

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

    if -4.1042908358469514e-162 < (* x y) < 3.32813918115226e-203 or 1.3220220969464353e+136 < (* x y)

    1. Initial program 12.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.7422477441071717 \cdot 10^{287}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -4.10429083584695144 \cdot 10^{-162} \lor \neg \left(x \cdot y \le 3.3281391811522597 \cdot 10^{-203}\right) \land x \cdot y \le 1.32202209694643531 \cdot 10^{136}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019199 
(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))