Average Error: 5.9 → 1.6
Time: 11.0s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le 0.0:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}} \cdot \left(\frac{\sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)\\ \mathbf{elif}\;x \cdot y \le 3.918434502265583073779712792396980825844 \cdot 10^{199}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le 0.0:\\
\;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}} \cdot \left(\frac{\sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)\\

\mathbf{elif}\;x \cdot y \le 3.918434502265583073779712792396980825844 \cdot 10^{199}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r815509 = x;
        double r815510 = y;
        double r815511 = r815509 * r815510;
        double r815512 = z;
        double r815513 = r815511 / r815512;
        return r815513;
}

double f(double x, double y, double z) {
        double r815514 = x;
        double r815515 = y;
        double r815516 = r815514 * r815515;
        double r815517 = 0.0;
        bool r815518 = r815516 <= r815517;
        double r815519 = cbrt(r815514);
        double r815520 = r815519 * r815519;
        double r815521 = z;
        double r815522 = cbrt(r815521);
        double r815523 = r815520 / r815522;
        double r815524 = r815519 / r815522;
        double r815525 = r815515 / r815522;
        double r815526 = r815524 * r815525;
        double r815527 = r815523 * r815526;
        double r815528 = 3.918434502265583e+199;
        bool r815529 = r815516 <= r815528;
        double r815530 = r815516 / r815521;
        double r815531 = r815515 / r815521;
        double r815532 = r815514 * r815531;
        double r815533 = r815529 ? r815530 : r815532;
        double r815534 = r815518 ? r815527 : r815533;
        return r815534;
}

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.0
Herbie1.6
\[\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) < 0.0

    1. Initial program 6.2

      \[\frac{x \cdot y}{z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt7.0

      \[\leadsto \frac{x \cdot y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    4. Applied times-frac5.3

      \[\leadsto \color{blue}{\frac{x}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt5.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\]
    7. Applied times-frac5.5

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{z}}\right)} \cdot \frac{y}{\sqrt[3]{z}}\]
    8. Applied associate-*l*2.6

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

    if 0.0 < (* x y) < 3.918434502265583e+199

    1. Initial program 3.1

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

    if 3.918434502265583e+199 < (* x y)

    1. Initial program 24.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le 0.0:\\ \;\;\;\;\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{z}} \cdot \left(\frac{\sqrt[3]{x}}{\sqrt[3]{z}} \cdot \frac{y}{\sqrt[3]{z}}\right)\\ \mathbf{elif}\;x \cdot y \le 3.918434502265583073779712792396980825844 \cdot 10^{199}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +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))