Average Error: 6.1 → 0.9
Time: 1.6s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.70578255955175172 \cdot 10^{222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6336268525467556 \cdot 10^{-109}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 2.391070767296255 \cdot 10^{-243}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.3405022564328761 \cdot 10^{154}:\\ \;\;\;\;\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 -1.70578255955175172 \cdot 10^{222}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

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

\mathbf{elif}\;x \cdot y \le 5.3405022564328761 \cdot 10^{154}:\\
\;\;\;\;\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 r802272 = x;
        double r802273 = y;
        double r802274 = r802272 * r802273;
        double r802275 = z;
        double r802276 = r802274 / r802275;
        return r802276;
}

double f(double x, double y, double z) {
        double r802277 = x;
        double r802278 = y;
        double r802279 = r802277 * r802278;
        double r802280 = -1.7057825595517517e+222;
        bool r802281 = r802279 <= r802280;
        double r802282 = z;
        double r802283 = r802278 / r802282;
        double r802284 = r802277 * r802283;
        double r802285 = -2.6336268525467556e-109;
        bool r802286 = r802279 <= r802285;
        double r802287 = 1.0;
        double r802288 = r802282 / r802279;
        double r802289 = r802287 / r802288;
        double r802290 = 2.391070767296255e-243;
        bool r802291 = r802279 <= r802290;
        double r802292 = 5.340502256432876e+154;
        bool r802293 = r802279 <= r802292;
        double r802294 = r802287 / r802282;
        double r802295 = r802279 * r802294;
        double r802296 = r802282 / r802278;
        double r802297 = r802277 / r802296;
        double r802298 = r802293 ? r802295 : r802297;
        double r802299 = r802291 ? r802284 : r802298;
        double r802300 = r802286 ? r802289 : r802299;
        double r802301 = r802281 ? r802284 : r802300;
        return r802301;
}

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.1
Target6.3
Herbie0.9
\[\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) < -1.7057825595517517e+222 or -2.6336268525467556e-109 < (* x y) < 2.391070767296255e-243

    1. Initial program 12.2

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

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

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

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

    if -1.7057825595517517e+222 < (* x y) < -2.6336268525467556e-109

    1. Initial program 0.3

      \[\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 2.391070767296255e-243 < (* x y) < 5.340502256432876e+154

    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 5.340502256432876e+154 < (* x y)

    1. Initial program 18.1

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

      \[\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 -1.70578255955175172 \cdot 10^{222}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le -2.6336268525467556 \cdot 10^{-109}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;x \cdot y \le 2.391070767296255 \cdot 10^{-243}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;x \cdot y \le 5.3405022564328761 \cdot 10^{154}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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