Average Error: 14.8 → 0.3
Time: 2.7s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le -2.032946575227289082299442188903898755778 \cdot 10^{-265}:\\ \;\;\;\;{\left(\frac{x}{\frac{z}{y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le 1.707355746264835359667361500171699768251 \cdot 10^{-300}:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le 7.166584424187464259231246965323639075754 \cdot 10^{225}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty:\\
\;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 7.166584424187464259231246965323639075754 \cdot 10^{225}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{else}:\\
\;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r546008 = x;
        double r546009 = y;
        double r546010 = z;
        double r546011 = r546009 / r546010;
        double r546012 = t;
        double r546013 = r546011 * r546012;
        double r546014 = r546013 / r546012;
        double r546015 = r546008 * r546014;
        return r546015;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r546016 = y;
        double r546017 = z;
        double r546018 = r546016 / r546017;
        double r546019 = -inf.0;
        bool r546020 = r546018 <= r546019;
        double r546021 = 1.0;
        double r546022 = x;
        double r546023 = r546022 * r546016;
        double r546024 = r546017 / r546023;
        double r546025 = r546021 / r546024;
        double r546026 = pow(r546025, r546021);
        double r546027 = -2.032946575227289e-265;
        bool r546028 = r546018 <= r546027;
        double r546029 = r546017 / r546016;
        double r546030 = r546022 / r546029;
        double r546031 = pow(r546030, r546021);
        double r546032 = 1.7073557462648354e-300;
        bool r546033 = r546018 <= r546032;
        double r546034 = 7.166584424187464e+225;
        bool r546035 = r546018 <= r546034;
        double r546036 = r546022 * r546018;
        double r546037 = r546035 ? r546036 : r546026;
        double r546038 = r546033 ? r546026 : r546037;
        double r546039 = r546028 ? r546031 : r546038;
        double r546040 = r546020 ? r546026 : r546039;
        return r546040;
}

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.8
Target1.6
Herbie0.3
\[\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 3 regimes
  2. if (/ y z) < -inf.0 or -2.032946575227289e-265 < (/ y z) < 1.7073557462648354e-300 or 7.166584424187464e+225 < (/ y z)

    1. Initial program 29.1

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity24.1

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    9. Using strategy rm
    10. Applied pow16.0

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

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

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

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

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

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

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

      \[\leadsto {\color{blue}{\left(\frac{x \cdot y}{z}\right)}}^{1}\]
    18. Using strategy rm
    19. Applied clear-num0.7

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

    if -inf.0 < (/ y z) < -2.032946575227289e-265

    1. Initial program 10.6

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.2

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right)} \cdot \frac{\sqrt[3]{y}}{z}\]
    9. Using strategy rm
    10. Applied pow15.5

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

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

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

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

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

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

      \[\leadsto \color{blue}{{\left(\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot x\right) \cdot \frac{\sqrt[3]{y}}{z}\right)}^{1}}\]
    17. Simplified8.2

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

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

    if 1.7073557462648354e-300 < (/ y z) < 7.166584424187464e+225

    1. Initial program 9.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le -2.032946575227289082299442188903898755778 \cdot 10^{-265}:\\ \;\;\;\;{\left(\frac{x}{\frac{z}{y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le 1.707355746264835359667361500171699768251 \cdot 10^{-300}:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \mathbf{elif}\;\frac{y}{z} \le 7.166584424187464259231246965323639075754 \cdot 10^{225}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;{\left(\frac{1}{\frac{z}{x \cdot y}}\right)}^{1}\\ \end{array}\]

Reproduce

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