Average Error: 6.7 → 0.4
Time: 2.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.8728392574617784 \cdot 10^{-186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.83270628172182268 \cdot 10^{-206}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 1.4178882238079705 \cdot 10^{214}:\\ \;\;\;\;\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:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

\mathbf{elif}\;x \cdot y \le 1.4178882238079705 \cdot 10^{214}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r704854 = x;
        double r704855 = y;
        double r704856 = r704854 * r704855;
        double r704857 = z;
        double r704858 = r704856 / r704857;
        return r704858;
}

double f(double x, double y, double z) {
        double r704859 = x;
        double r704860 = y;
        double r704861 = r704859 * r704860;
        double r704862 = -inf.0;
        bool r704863 = r704861 <= r704862;
        double r704864 = z;
        double r704865 = r704860 / r704864;
        double r704866 = r704859 * r704865;
        double r704867 = -1.8728392574617784e-186;
        bool r704868 = r704861 <= r704867;
        double r704869 = r704861 / r704864;
        double r704870 = 2.8327062817218227e-206;
        bool r704871 = r704861 <= r704870;
        double r704872 = r704864 / r704860;
        double r704873 = r704859 / r704872;
        double r704874 = 1.4178882238079705e+214;
        bool r704875 = r704861 <= r704874;
        double r704876 = r704859 / r704864;
        double r704877 = r704876 * r704860;
        double r704878 = r704875 ? r704869 : r704877;
        double r704879 = r704871 ? r704873 : r704878;
        double r704880 = r704868 ? r704869 : r704879;
        double r704881 = r704863 ? r704866 : r704880;
        return r704881;
}

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.7
Target6.2
Herbie0.4
\[\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) < -inf.0

    1. Initial program 64.0

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

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

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

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

    if -inf.0 < (* x y) < -1.8728392574617784e-186 or 2.8327062817218227e-206 < (* x y) < 1.4178882238079705e+214

    1. Initial program 0.2

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Taylor expanded around 0 0.2

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

    if -1.8728392574617784e-186 < (* x y) < 2.8327062817218227e-206

    1. Initial program 11.0

      \[\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.4178882238079705e+214 < (* x y)

    1. Initial program 30.0

      \[\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/1.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y = -\infty:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.8728392574617784 \cdot 10^{-186}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 2.83270628172182268 \cdot 10^{-206}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 1.4178882238079705 \cdot 10^{214}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

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