Average Error: 6.3 → 0.7
Time: 8.0s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -6.28788729122934697 \cdot 10^{-143}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5244214612354576 \cdot 10^{-284}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\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 -1.00913018527108544 \cdot 10^{193}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

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

\mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r730873 = x;
        double r730874 = y;
        double r730875 = r730873 * r730874;
        double r730876 = z;
        double r730877 = r730875 / r730876;
        return r730877;
}

double f(double x, double y, double z) {
        double r730878 = x;
        double r730879 = y;
        double r730880 = r730878 * r730879;
        double r730881 = -1.0091301852710854e+193;
        bool r730882 = r730880 <= r730881;
        double r730883 = z;
        double r730884 = r730883 / r730879;
        double r730885 = r730878 / r730884;
        double r730886 = -6.287887291229347e-143;
        bool r730887 = r730880 <= r730886;
        double r730888 = 1.0;
        double r730889 = r730888 / r730883;
        double r730890 = r730880 * r730889;
        double r730891 = 1.5244214612354576e-284;
        bool r730892 = r730880 <= r730891;
        double r730893 = r730878 / r730883;
        double r730894 = r730879 * r730893;
        double r730895 = 9.811295412498549e+171;
        bool r730896 = r730880 <= r730895;
        double r730897 = r730880 / r730883;
        double r730898 = r730879 / r730883;
        double r730899 = r730878 * r730898;
        double r730900 = r730896 ? r730897 : r730899;
        double r730901 = r730892 ? r730894 : r730900;
        double r730902 = r730887 ? r730890 : r730901;
        double r730903 = r730882 ? r730885 : r730902;
        return r730903;
}

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.2
Herbie0.7
\[\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 5 regimes
  2. if (* x y) < -1.0091301852710854e+193

    1. Initial program 24.7

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

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

    if -1.0091301852710854e+193 < (* x y) < -6.287887291229347e-143

    1. Initial program 0.3

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

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

    if -6.287887291229347e-143 < (* x y) < 1.5244214612354576e-284

    1. Initial program 11.1

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied clear-num1.4

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y}}{x}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity1.4

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

      \[\leadsto \frac{1}{\frac{\frac{z}{\color{blue}{1 \cdot y}}}{1 \cdot x}}\]
    9. Applied *-un-lft-identity1.4

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{\frac{1}{1}}{1} \cdot \frac{\frac{z}{y}}{x}}}\]
    12. Applied add-cube-cbrt1.4

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{\frac{1}{1}}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\frac{z}{y}}{x}}}\]
    14. Simplified1.4

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

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

    if 1.5244214612354576e-284 < (* x y) < 9.811295412498549e+171

    1. Initial program 0.2

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

    if 9.811295412498549e+171 < (* x y)

    1. Initial program 22.4

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity1.7

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{1 \cdot y}}}\]
    6. Applied *-un-lft-identity1.7

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

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

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

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

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

      \[\leadsto 1 \cdot \color{blue}{\left(x \cdot \frac{y}{z}\right)}\]
  3. Recombined 5 regimes into one program.
  4. Final simplification0.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y \le -1.00913018527108544 \cdot 10^{193}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le -6.28788729122934697 \cdot 10^{-143}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;x \cdot y \le 1.5244214612354576 \cdot 10^{-284}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;x \cdot y \le 9.81129541249854884 \cdot 10^{171}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

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