Average Error: 5.9 → 0.7
Time: 2.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -6.19747986177150750809252245117595786488 \cdot 10^{145}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.552575327556019379295511877737835951597 \cdot 10^{-209}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.185107420516714761464092917105521838974 \cdot 10^{-194}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 2.927841217235156761172687372675221348043 \cdot 10^{173}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le -6.19747986177150750809252245117595786488 \cdot 10^{145}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

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

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

\end{array}
double f(double x, double y, double z) {
        double r588464 = x;
        double r588465 = y;
        double r588466 = r588464 * r588465;
        double r588467 = z;
        double r588468 = r588466 / r588467;
        return r588468;
}

double f(double x, double y, double z) {
        double r588469 = x;
        double r588470 = y;
        double r588471 = r588469 * r588470;
        double r588472 = -6.197479861771508e+145;
        bool r588473 = r588471 <= r588472;
        double r588474 = z;
        double r588475 = r588470 / r588474;
        double r588476 = r588469 * r588475;
        double r588477 = -3.5525753275560194e-209;
        bool r588478 = r588471 <= r588477;
        double r588479 = 1.0;
        double r588480 = r588479 / r588474;
        double r588481 = r588471 * r588480;
        double r588482 = 1.1851074205167148e-194;
        bool r588483 = r588471 <= r588482;
        double r588484 = r588474 / r588470;
        double r588485 = r588469 / r588484;
        double r588486 = 2.927841217235157e+173;
        bool r588487 = r588471 <= r588486;
        double r588488 = r588487 ? r588481 : r588485;
        double r588489 = r588483 ? r588485 : r588488;
        double r588490 = r588478 ? r588481 : r588489;
        double r588491 = r588473 ? r588476 : r588490;
        return r588491;
}

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

Original5.9
Target6.1
Herbie0.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) < -6.197479861771508e+145

    1. Initial program 17.4

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

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

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

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

    if -6.197479861771508e+145 < (* x y) < -3.5525753275560194e-209 or 1.1851074205167148e-194 < (* x y) < 2.927841217235157e+173

    1. Initial program 0.2

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

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

    if -3.5525753275560194e-209 < (* x y) < 1.1851074205167148e-194 or 2.927841217235157e+173 < (* x y)

    1. Initial program 12.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -6.19747986177150750809252245117595786488 \cdot 10^{145}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -3.552575327556019379295511877737835951597 \cdot 10^{-209}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.185107420516714761464092917105521838974 \cdot 10^{-194}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 2.927841217235156761172687372675221348043 \cdot 10^{173}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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