Average Error: 14.7 → 1.1
Time: 15.6s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -2.588366971627017444543194392656819407323 \cdot 10^{79}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{y}{z} \le -7.584778841906227496781487885537839730751 \cdot 10^{-279}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 0.0:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.406079879178553538420301463833789327206 \cdot 10^{177}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -2.588366971627017444543194392656819407323 \cdot 10^{79}:\\
\;\;\;\;\frac{x}{z} \cdot y\\

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

\mathbf{elif}\;\frac{y}{z} \le 0.0:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 1.406079879178553538420301463833789327206 \cdot 10^{177}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r703835 = x;
        double r703836 = y;
        double r703837 = z;
        double r703838 = r703836 / r703837;
        double r703839 = t;
        double r703840 = r703838 * r703839;
        double r703841 = r703840 / r703839;
        double r703842 = r703835 * r703841;
        return r703842;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r703843 = y;
        double r703844 = z;
        double r703845 = r703843 / r703844;
        double r703846 = -2.5883669716270174e+79;
        bool r703847 = r703845 <= r703846;
        double r703848 = x;
        double r703849 = r703848 / r703844;
        double r703850 = r703849 * r703843;
        double r703851 = -7.584778841906227e-279;
        bool r703852 = r703845 <= r703851;
        double r703853 = r703845 * r703848;
        double r703854 = 0.0;
        bool r703855 = r703845 <= r703854;
        double r703856 = r703848 * r703843;
        double r703857 = r703856 / r703844;
        double r703858 = 1.4060798791785535e+177;
        bool r703859 = r703845 <= r703858;
        double r703860 = r703844 / r703843;
        double r703861 = r703848 / r703860;
        double r703862 = r703859 ? r703861 : r703850;
        double r703863 = r703855 ? r703857 : r703862;
        double r703864 = r703852 ? r703853 : r703863;
        double r703865 = r703847 ? r703850 : r703864;
        return r703865;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.7
Target1.5
Herbie1.1
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.206722051230450047215521150762600712224 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390632993316700759382836344 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415216825328199697215652986 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.008718050240713347941382056648619307142 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -2.5883669716270174e+79 or 1.4060798791785535e+177 < (/ y z)

    1. Initial program 31.5

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified16.2

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{{x}^{1}}\]
    5. Applied pow116.2

      \[\leadsto \color{blue}{{\left(\frac{y}{z}\right)}^{1}} \cdot {x}^{1}\]
    6. Applied pow-prod-down16.2

      \[\leadsto \color{blue}{{\left(\frac{y}{z} \cdot x\right)}^{1}}\]
    7. Simplified3.4

      \[\leadsto {\color{blue}{\left(\frac{x \cdot y}{z}\right)}}^{1}\]
    8. Using strategy rm
    9. Applied associate-/l*14.7

      \[\leadsto {\color{blue}{\left(\frac{x}{\frac{z}{y}}\right)}}^{1}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt15.5

      \[\leadsto {\left(\frac{x}{\frac{z}{\color{blue}{\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}}}}\right)}^{1}\]
    12. Applied *-un-lft-identity15.5

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

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

      \[\leadsto {\color{blue}{\left(\frac{\frac{x}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}}}}{\frac{z}{\sqrt[3]{y}}}\right)}}^{1}\]
    15. Simplified5.6

      \[\leadsto {\left(\frac{\color{blue}{x \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)}}{\frac{z}{\sqrt[3]{y}}}\right)}^{1}\]
    16. Using strategy rm
    17. Applied div-inv5.6

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

      \[\leadsto {\color{blue}{\left(\frac{x}{z} \cdot \frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\frac{1}{\sqrt[3]{y}}}\right)}}^{1}\]
    19. Simplified4.0

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

    if -2.5883669716270174e+79 < (/ y z) < -7.584778841906227e-279

    1. Initial program 8.4

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

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

    if -7.584778841906227e-279 < (/ y z) < 0.0

    1. Initial program 18.3

      \[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
    2. Simplified15.3

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{{x}^{1}}\]
    5. Applied pow115.3

      \[\leadsto \color{blue}{{\left(\frac{y}{z}\right)}^{1}} \cdot {x}^{1}\]
    6. Applied pow-prod-down15.3

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

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

    if 0.0 < (/ y z) < 1.4060798791785535e+177

    1. Initial program 10.0

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

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

      \[\leadsto \frac{y}{z} \cdot \color{blue}{{x}^{1}}\]
    5. Applied pow13.4

      \[\leadsto \color{blue}{{\left(\frac{y}{z}\right)}^{1}} \cdot {x}^{1}\]
    6. Applied pow-prod-down3.4

      \[\leadsto \color{blue}{{\left(\frac{y}{z} \cdot x\right)}^{1}}\]
    7. Simplified7.3

      \[\leadsto {\color{blue}{\left(\frac{x \cdot y}{z}\right)}}^{1}\]
    8. Using strategy rm
    9. Applied associate-/l*3.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -2.588366971627017444543194392656819407323 \cdot 10^{79}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \mathbf{elif}\;\frac{y}{z} \le -7.584778841906227496781487885537839730751 \cdot 10^{-279}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 0.0:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.406079879178553538420301463833789327206 \cdot 10^{177}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019351 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
  :precision binary64

  :herbie-target
  (if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))

  (* x (/ (* (/ y z) t) t)))