Average Error: 6.5 → 1.7
Time: 7.0s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \le -2.984365653658576528026171626892729871549 \cdot 10^{240}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -6.605415362301299623001202126727553395613 \cdot 10^{-208} \lor \neg \left(\frac{x \cdot y}{z} \le -0.0\right) \land \frac{x \cdot y}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;\frac{x \cdot y}{z} \le -2.984365653658576528026171626892729871549 \cdot 10^{240}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

\mathbf{elif}\;\frac{x \cdot y}{z} \le -6.605415362301299623001202126727553395613 \cdot 10^{-208} \lor \neg \left(\frac{x \cdot y}{z} \le -0.0\right) \land \frac{x \cdot y}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r578902 = x;
        double r578903 = y;
        double r578904 = r578902 * r578903;
        double r578905 = z;
        double r578906 = r578904 / r578905;
        return r578906;
}

double f(double x, double y, double z) {
        double r578907 = x;
        double r578908 = y;
        double r578909 = r578907 * r578908;
        double r578910 = z;
        double r578911 = r578909 / r578910;
        double r578912 = -2.9843656536585765e+240;
        bool r578913 = r578911 <= r578912;
        double r578914 = r578907 / r578910;
        double r578915 = r578914 * r578908;
        double r578916 = -6.6054153623013e-208;
        bool r578917 = r578911 <= r578916;
        double r578918 = -0.0;
        bool r578919 = r578911 <= r578918;
        double r578920 = !r578919;
        double r578921 = 6.000688925971464e+299;
        bool r578922 = r578911 <= r578921;
        bool r578923 = r578920 && r578922;
        bool r578924 = r578917 || r578923;
        double r578925 = r578908 / r578910;
        double r578926 = r578925 * r578907;
        double r578927 = r578924 ? r578911 : r578926;
        double r578928 = r578913 ? r578915 : r578927;
        return r578928;
}

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.2
Herbie1.7
\[\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) z) < -2.9843656536585765e+240

    1. Initial program 31.8

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity7.8

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{1 \cdot y}}}\]
    6. Applied *-un-lft-identity7.8

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

      \[\leadsto \frac{x}{\color{blue}{\frac{1}{1} \cdot \frac{z}{y}}}\]
    8. Applied *-un-lft-identity7.8

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\frac{1}{1} \cdot \frac{z}{y}}\]
    9. Applied times-frac7.8

      \[\leadsto \color{blue}{\frac{1}{\frac{1}{1}} \cdot \frac{x}{\frac{z}{y}}}\]
    10. Simplified7.8

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

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

    if -2.9843656536585765e+240 < (/ (* x y) z) < -6.6054153623013e-208 or -0.0 < (/ (* x y) z) < 6.000688925971464e+299

    1. Initial program 2.2

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

    if -6.6054153623013e-208 < (/ (* x y) z) < -0.0 or 6.000688925971464e+299 < (/ (* x y) z)

    1. Initial program 16.1

      \[\frac{x \cdot y}{z}\]
    2. Simplified4.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{x \cdot y}{z} \le -2.984365653658576528026171626892729871549 \cdot 10^{240}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{x \cdot y}{z} \le -6.605415362301299623001202126727553395613 \cdot 10^{-208} \lor \neg \left(\frac{x \cdot y}{z} \le -0.0\right) \land \frac{x \cdot y}{z} \le 6.000688925971464265220404848603213842526 \cdot 10^{299}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

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