Average Error: 6.3 → 1.2
Time: 13.8s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le 2.552519435223795033569183425060673013039 \cdot 10^{-314}:\\ \;\;\;\;\left(\frac{\sqrt[3]{y}}{\sqrt[3]{z}} \cdot x\right) \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\ \mathbf{elif}\;x \cdot y \le 4.552391931798920032050045519550199226521 \cdot 10^{228}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]
\frac{x \cdot y}{z}
\begin{array}{l}
\mathbf{if}\;x \cdot y \le 2.552519435223795033569183425060673013039 \cdot 10^{-314}:\\
\;\;\;\;\left(\frac{\sqrt[3]{y}}{\sqrt[3]{z}} \cdot x\right) \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\

\mathbf{elif}\;x \cdot y \le 4.552391931798920032050045519550199226521 \cdot 10^{228}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r672913 = x;
        double r672914 = y;
        double r672915 = r672913 * r672914;
        double r672916 = z;
        double r672917 = r672915 / r672916;
        return r672917;
}

double f(double x, double y, double z) {
        double r672918 = x;
        double r672919 = y;
        double r672920 = r672918 * r672919;
        double r672921 = 2.5525194352238e-314;
        bool r672922 = r672920 <= r672921;
        double r672923 = cbrt(r672919);
        double r672924 = z;
        double r672925 = cbrt(r672924);
        double r672926 = r672923 / r672925;
        double r672927 = r672926 * r672918;
        double r672928 = r672923 * r672923;
        double r672929 = r672925 * r672925;
        double r672930 = r672928 / r672929;
        double r672931 = r672927 * r672930;
        double r672932 = 4.55239193179892e+228;
        bool r672933 = r672920 <= r672932;
        double r672934 = r672920 / r672924;
        double r672935 = r672918 / r672924;
        double r672936 = r672935 * r672919;
        double r672937 = r672933 ? r672934 : r672936;
        double r672938 = r672922 ? r672931 : r672937;
        return r672938;
}

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.3
Target6.4
Herbie1.2
\[\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) < 2.5525194352238e-314

    1. Initial program 7.7

      \[\frac{x \cdot y}{z}\]
    2. Simplified5.4

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt6.2

      \[\leadsto \frac{y}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}} \cdot x\]
    5. Applied add-cube-cbrt6.3

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

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

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

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

    if 2.5525194352238e-314 < (* x y) < 4.55239193179892e+228

    1. Initial program 0.3

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

    if 4.55239193179892e+228 < (* x y)

    1. Initial program 35.3

      \[\frac{x \cdot y}{z}\]
    2. Simplified0.6

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    3. Using strategy rm
    4. Applied div-inv0.6

      \[\leadsto \color{blue}{\left(y \cdot \frac{1}{z}\right)} \cdot x\]
    5. Applied associate-*l*0.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le 2.552519435223795033569183425060673013039 \cdot 10^{-314}:\\ \;\;\;\;\left(\frac{\sqrt[3]{y}}{\sqrt[3]{z}} \cdot x\right) \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\\ \mathbf{elif}\;x \cdot y \le 4.552391931798920032050045519550199226521 \cdot 10^{228}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

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