Average Error: 6.0 → 2.0
Time: 2.2s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -4.30725126675749626 \cdot 10^{228}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -1.7658809956095531 \cdot 10^{-162}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5128375479097505 \cdot 10^{-176}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z}}{\frac{1}{x \cdot y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -4.30725126675749626 \cdot 10^{228}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r729762 = x;
        double r729763 = y;
        double r729764 = r729762 * r729763;
        double r729765 = z;
        double r729766 = r729764 / r729765;
        return r729766;
}

double f(double x, double y, double z) {
        double r729767 = x;
        double r729768 = y;
        double r729769 = r729767 * r729768;
        double r729770 = -4.307251266757496e+228;
        bool r729771 = r729769 <= r729770;
        double r729772 = z;
        double r729773 = r729772 / r729768;
        double r729774 = r729767 / r729773;
        double r729775 = -1.765880995609553e-162;
        bool r729776 = r729769 <= r729775;
        double r729777 = 1.0;
        double r729778 = r729777 / r729772;
        double r729779 = r729769 * r729778;
        double r729780 = 1.5128375479097505e-176;
        bool r729781 = r729769 <= r729780;
        double r729782 = r729768 / r729772;
        double r729783 = r729767 * r729782;
        double r729784 = r729777 / r729769;
        double r729785 = r729778 / r729784;
        double r729786 = r729781 ? r729783 : r729785;
        double r729787 = r729776 ? r729779 : r729786;
        double r729788 = r729771 ? r729774 : r729787;
        return r729788;
}

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.0
Target6.3
Herbie2.0
\[\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) < -4.307251266757496e+228

    1. Initial program 34.7

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

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

    if -4.307251266757496e+228 < (* x y) < -1.765880995609553e-162

    1. Initial program 0.3

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

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

    if -1.765880995609553e-162 < (* x y) < 1.5128375479097505e-176

    1. Initial program 8.8

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

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

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

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

    if 1.5128375479097505e-176 < (* x y)

    1. Initial program 4.1

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    4. Using strategy rm
    5. Applied div-inv4.6

      \[\leadsto \frac{1}{\color{blue}{z \cdot \frac{1}{x \cdot y}}}\]
    6. Applied associate-/r*4.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -4.30725126675749626 \cdot 10^{228}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -1.7658809956095531 \cdot 10^{-162}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5128375479097505 \cdot 10^{-176}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1}{z}}{\frac{1}{x \cdot y}}\\ \end{array}\]

Reproduce

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