Average Error: 6.4 → 0.7
Time: 4.3s
Precision: 64
\[\frac{x \cdot y}{z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y \le -1.394495778794157817173263708359068376665 \cdot 10^{144}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -2.091115834215142392182824625708863732465 \cdot 10^{-215}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.107151871760683778945393640864932427286 \cdot 10^{-309}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 8.013896806549786117243748175613103383758 \cdot 10^{151}:\\ \;\;\;\;\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 -1.394495778794157817173263708359068376665 \cdot 10^{144}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

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

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

\mathbf{elif}\;x \cdot y \le 8.013896806549786117243748175613103383758 \cdot 10^{151}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z) {
        double r917881 = x;
        double r917882 = y;
        double r917883 = r917881 * r917882;
        double r917884 = z;
        double r917885 = r917883 / r917884;
        return r917885;
}

double f(double x, double y, double z) {
        double r917886 = x;
        double r917887 = y;
        double r917888 = r917886 * r917887;
        double r917889 = -1.3944957787941578e+144;
        bool r917890 = r917888 <= r917889;
        double r917891 = z;
        double r917892 = r917886 / r917891;
        double r917893 = r917892 * r917887;
        double r917894 = -2.0911158342151424e-215;
        bool r917895 = r917888 <= r917894;
        double r917896 = r917888 / r917891;
        double r917897 = 1.107151871760684e-309;
        bool r917898 = r917888 <= r917897;
        double r917899 = r917891 / r917887;
        double r917900 = r917886 / r917899;
        double r917901 = 8.013896806549786e+151;
        bool r917902 = r917888 <= r917901;
        double r917903 = r917902 ? r917896 : r917893;
        double r917904 = r917898 ? r917900 : r917903;
        double r917905 = r917895 ? r917896 : r917904;
        double r917906 = r917890 ? r917893 : r917905;
        return r917906;
}

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.4
Target6.3
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) < -1.3944957787941578e+144 or 8.013896806549786e+151 < (* x y)

    1. Initial program 19.0

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

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    4. Using strategy rm
    5. Applied associate-/r/3.0

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

    if -1.3944957787941578e+144 < (* x y) < -2.0911158342151424e-215 or 1.107151871760684e-309 < (* x y) < 8.013896806549786e+151

    1. Initial program 0.2

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

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

      \[\leadsto \frac{x}{\frac{z}{\color{blue}{1 \cdot y}}}\]
    6. Applied add-cube-cbrt10.2

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{x}{\frac{\sqrt[3]{z}}{y}}\]
    11. Using strategy rm
    12. Applied associate-*l/2.9

      \[\leadsto \color{blue}{\frac{1 \cdot \frac{x}{\frac{\sqrt[3]{z}}{y}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}\]
    13. Simplified2.9

      \[\leadsto \frac{\color{blue}{\frac{x}{\frac{\sqrt[3]{z}}{y}}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\]
    14. Taylor expanded around 0 0.2

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

    if -2.0911158342151424e-215 < (* x y) < 1.107151871760684e-309

    1. Initial program 14.4

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

      \[\leadsto \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 -1.394495778794157817173263708359068376665 \cdot 10^{144}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;x \cdot y \le -2.091115834215142392182824625708863732465 \cdot 10^{-215}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;x \cdot y \le 1.107151871760683778945393640864932427286 \cdot 10^{-309}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;x \cdot y \le 8.013896806549786117243748175613103383758 \cdot 10^{151}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

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