Average Error: 6.3 → 0.9
Time: 13.1s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -3.623394523895839480218082027316284667111 \cdot 10^{216}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.520798265727962225313816823874310331012 \cdot 10^{-182}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \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.623394523895839480218082027316284667111 \cdot 10^{216}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\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 r29759611 = x;
        double r29759612 = y;
        double r29759613 = r29759611 * r29759612;
        double r29759614 = z;
        double r29759615 = r29759613 / r29759614;
        return r29759615;
}

double f(double x, double y, double z) {
        double r29759616 = x;
        double r29759617 = y;
        double r29759618 = r29759616 * r29759617;
        double r29759619 = -3.6233945238958395e+216;
        bool r29759620 = r29759618 <= r29759619;
        double r29759621 = z;
        double r29759622 = r29759617 / r29759621;
        double r29759623 = r29759616 * r29759622;
        double r29759624 = -1.5207982657279622e-182;
        bool r29759625 = r29759618 <= r29759624;
        double r29759626 = 1.0;
        double r29759627 = r29759626 / r29759621;
        double r29759628 = r29759627 * r29759618;
        double r29759629 = 0.0;
        bool r29759630 = r29759618 <= r29759629;
        double r29759631 = 3.001885948766618e+118;
        bool r29759632 = r29759618 <= r29759631;
        double r29759633 = r29759621 / r29759617;
        double r29759634 = r29759616 / r29759633;
        double r29759635 = r29759632 ? r29759628 : r29759634;
        double r29759636 = r29759630 ? r29759623 : r29759635;
        double r29759637 = r29759625 ? r29759628 : r29759636;
        double r29759638 = r29759620 ? r29759623 : r29759637;
        return r29759638;
}

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 3 regimes
  2. if (* x y) < -3.6233945238958395e+216 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.6233945238958395e+216 < (* x y) < -1.5207982657279622e-182 or 0.0 < (* x y) < 3.001885948766618e+118

    1. Initial program 0.4

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

      \[\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 3 regimes into one program.
  4. Final simplification0.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -3.623394523895839480218082027316284667111 \cdot 10^{216}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -1.520798265727962225313816823874310331012 \cdot 10^{-182}:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \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 +o rules:numerics
(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))