Average Error: 14.0 → 5.4
Time: 8.1s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -9.484727702764666 \cdot 10^{+241}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \le -2.333076602971364 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;y \le 6.356954331308777 \cdot 10^{-261}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \le 5.784716735603109 \cdot 10^{+161}:\\ \;\;\;\;\left(\frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z}}\right) \cdot \frac{1}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;y \le -9.484727702764666 \cdot 10^{+241}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;y \le -2.333076602971364 \cdot 10^{-69}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\

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

\mathbf{elif}\;y \le 5.784716735603109 \cdot 10^{+161}:\\
\;\;\;\;\left(\frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z}}\right) \cdot \frac{1}{\sqrt[3]{z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r31426009 = x;
        double r31426010 = y;
        double r31426011 = z;
        double r31426012 = r31426010 / r31426011;
        double r31426013 = t;
        double r31426014 = r31426012 * r31426013;
        double r31426015 = r31426014 / r31426013;
        double r31426016 = r31426009 * r31426015;
        return r31426016;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r31426017 = y;
        double r31426018 = -9.484727702764666e+241;
        bool r31426019 = r31426017 <= r31426018;
        double r31426020 = x;
        double r31426021 = r31426020 * r31426017;
        double r31426022 = z;
        double r31426023 = r31426021 / r31426022;
        double r31426024 = -2.333076602971364e-69;
        bool r31426025 = r31426017 <= r31426024;
        double r31426026 = 1.0;
        double r31426027 = r31426022 / r31426020;
        double r31426028 = r31426027 / r31426017;
        double r31426029 = r31426026 / r31426028;
        double r31426030 = 6.356954331308777e-261;
        bool r31426031 = r31426017 <= r31426030;
        double r31426032 = 5.784716735603109e+161;
        bool r31426033 = r31426017 <= r31426032;
        double r31426034 = cbrt(r31426022);
        double r31426035 = r31426017 / r31426034;
        double r31426036 = r31426020 / r31426034;
        double r31426037 = r31426035 * r31426036;
        double r31426038 = r31426026 / r31426034;
        double r31426039 = r31426037 * r31426038;
        double r31426040 = r31426033 ? r31426039 : r31426023;
        double r31426041 = r31426031 ? r31426023 : r31426040;
        double r31426042 = r31426025 ? r31426029 : r31426041;
        double r31426043 = r31426019 ? r31426023 : r31426042;
        return r31426043;
}

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.0
Target1.4
Herbie5.4
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045 \cdot 10^{+245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.907522236933906 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.0087180502407133 \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 < -9.484727702764666e+241 or -2.333076602971364e-69 < y < 6.356954331308777e-261 or 5.784716735603109e+161 < y

    1. Initial program 14.7

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
    5. Using strategy rm
    6. Applied un-div-inv8.2

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

    if -9.484727702764666e+241 < y < -2.333076602971364e-69

    1. Initial program 15.0

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

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

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    5. Using strategy rm
    6. Applied associate-/r*5.2

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

    if 6.356954331308777e-261 < y < 5.784716735603109e+161

    1. Initial program 12.7

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt4.8

      \[\leadsto \left(x \cdot y\right) \cdot \frac{1}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    7. Applied *-un-lft-identity4.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -9.484727702764666 \cdot 10^{+241}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \le -2.333076602971364 \cdot 10^{-69}:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;y \le 6.356954331308777 \cdot 10^{-261}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;y \le 5.784716735603109 \cdot 10^{+161}:\\ \;\;\;\;\left(\frac{y}{\sqrt[3]{z}} \cdot \frac{x}{\sqrt[3]{z}}\right) \cdot \frac{1}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019165 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"

  :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)))