Average Error: 5.9 → 0.7
Time: 2.4s
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}:\\ \;\;\;\;1 \cdot \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}:\\ \;\;\;\;1 \cdot \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}:\\
\;\;\;\;1 \cdot \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}:\\
\;\;\;\;1 \cdot \frac{x}{\frac{z}{y}}\\

\end{array}
double f(double x, double y, double z) {
        double r904075 = x;
        double r904076 = y;
        double r904077 = r904075 * r904076;
        double r904078 = z;
        double r904079 = r904077 / r904078;
        return r904079;
}

double f(double x, double y, double z) {
        double r904080 = x;
        double r904081 = y;
        double r904082 = r904080 * r904081;
        double r904083 = -6.197479861771508e+145;
        bool r904084 = r904082 <= r904083;
        double r904085 = z;
        double r904086 = r904081 / r904085;
        double r904087 = r904080 * r904086;
        double r904088 = -3.5525753275560194e-209;
        bool r904089 = r904082 <= r904088;
        double r904090 = 1.0;
        double r904091 = r904090 / r904085;
        double r904092 = r904082 * r904091;
        double r904093 = 1.1851074205167148e-194;
        bool r904094 = r904082 <= r904093;
        double r904095 = r904085 / r904081;
        double r904096 = r904080 / r904095;
        double r904097 = r904090 * r904096;
        double r904098 = 2.927841217235157e+173;
        bool r904099 = r904082 <= r904098;
        double r904100 = r904099 ? r904092 : r904097;
        double r904101 = r904094 ? r904097 : r904100;
        double r904102 = r904089 ? r904092 : r904101;
        double r904103 = r904084 ? r904087 : r904102;
        return r904103;
}

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 add-cube-cbrt13.1

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied associate-/r*13.1

      \[\leadsto \color{blue}{\frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity13.1

      \[\leadsto \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{\color{blue}{1 \cdot z}}}\]
    7. Applied cbrt-prod13.1

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

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}}{\sqrt[3]{1} \cdot \sqrt[3]{z}}\]
    9. Applied times-frac13.1

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{1}} \cdot \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    10. Simplified13.1

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}\]
    11. Simplified0.8

      \[\leadsto 1 \cdot \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}:\\ \;\;\;\;1 \cdot \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}:\\ \;\;\;\;1 \cdot \frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 +o rules:numerics
(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))