Average Error: 6.3 → 0.9
Time: 7.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.541804607093253917054386921541656074413 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.520798265727962225313816823874310331012 \cdot 10^{-182}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 3.001885948766617931306726374557801923471 \cdot 10^{118}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -3.541804607093253917054386921541656074413 \cdot 10^{217}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;x \cdot y \le -1.520798265727962225313816823874310331012 \cdot 10^{-182}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\

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

\mathbf{elif}\;x \cdot y \le 3.001885948766617931306726374557801923471 \cdot 10^{118}:\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\

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

\end{array}
double f(double x, double y, double z) {
        double r33269886 = x;
        double r33269887 = y;
        double r33269888 = r33269886 * r33269887;
        double r33269889 = z;
        double r33269890 = r33269888 / r33269889;
        return r33269890;
}

double f(double x, double y, double z) {
        double r33269891 = x;
        double r33269892 = y;
        double r33269893 = r33269891 * r33269892;
        double r33269894 = -3.541804607093254e+217;
        bool r33269895 = r33269893 <= r33269894;
        double r33269896 = z;
        double r33269897 = r33269892 / r33269896;
        double r33269898 = r33269891 * r33269897;
        double r33269899 = -1.5207982657279622e-182;
        bool r33269900 = r33269893 <= r33269899;
        double r33269901 = 1.0;
        double r33269902 = r33269896 / r33269893;
        double r33269903 = r33269901 / r33269902;
        double r33269904 = 0.0;
        bool r33269905 = r33269893 <= r33269904;
        double r33269906 = 3.001885948766618e+118;
        bool r33269907 = r33269893 <= r33269906;
        double r33269908 = r33269901 / r33269896;
        double r33269909 = r33269908 * r33269893;
        double r33269910 = r33269896 / r33269892;
        double r33269911 = r33269891 / r33269910;
        double r33269912 = r33269907 ? r33269909 : r33269911;
        double r33269913 = r33269905 ? r33269898 : r33269912;
        double r33269914 = r33269900 ? r33269903 : r33269913;
        double r33269915 = r33269895 ? r33269898 : r33269914;
        return r33269915;
}

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.2
Herbie0.9
\[\begin{array}{l} \mathbf{if}\;z \lt -4.262230790519428958560619200129306371776 \cdot 10^{-138}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \lt 1.704213066065047207696571404603247573308 \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) < -3.541804607093254e+217 or -1.5207982657279622e-182 < (* x y) < 0.0

    1. Initial program 16.4

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

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

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

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

    if -3.541804607093254e+217 < (* x y) < -1.5207982657279622e-182

    1. Initial program 0.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied clear-num0.6

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

    if 0.0 < (* x y) < 3.001885948766618e+118

    1. Initial program 0.5

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied div-inv0.6

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]

    if 3.001885948766618e+118 < (* x y)

    1. Initial program 15.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.541804607093253917054386921541656074413 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.520798265727962225313816823874310331012 \cdot 10^{-182}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 0.0:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 3.001885948766617931306726374557801923471 \cdot 10^{118}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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