Average Error: 14.1 → 6.1
Time: 12.4s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -3.74083005502277 \cdot 10^{-271}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;z \le 3.761519737827246 \cdot 10^{-224}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \le 4.956742987442585 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;z \le -3.74083005502277 \cdot 10^{-271}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\mathbf{elif}\;z \le 4.956742987442585 \cdot 10^{+22}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r31278878 = x;
        double r31278879 = y;
        double r31278880 = z;
        double r31278881 = r31278879 / r31278880;
        double r31278882 = t;
        double r31278883 = r31278881 * r31278882;
        double r31278884 = r31278883 / r31278882;
        double r31278885 = r31278878 * r31278884;
        return r31278885;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r31278886 = z;
        double r31278887 = -3.74083005502277e-271;
        bool r31278888 = r31278886 <= r31278887;
        double r31278889 = x;
        double r31278890 = y;
        double r31278891 = r31278886 / r31278890;
        double r31278892 = r31278889 / r31278891;
        double r31278893 = 3.761519737827246e-224;
        bool r31278894 = r31278886 <= r31278893;
        double r31278895 = r31278889 / r31278886;
        double r31278896 = r31278890 * r31278895;
        double r31278897 = 4.956742987442585e+22;
        bool r31278898 = r31278886 <= r31278897;
        double r31278899 = r31278889 * r31278890;
        double r31278900 = r31278899 / r31278886;
        double r31278901 = r31278898 ? r31278892 : r31278900;
        double r31278902 = r31278894 ? r31278896 : r31278901;
        double r31278903 = r31278888 ? r31278892 : r31278902;
        return r31278903;
}

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.1
Target1.5
Herbie6.1
\[\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 z < -3.74083005502277e-271 or 3.761519737827246e-224 < z < 4.956742987442585e+22

    1. Initial program 13.6

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

      \[\leadsto \color{blue}{y \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt6.5

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{x}{\sqrt[3]{z}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity5.3

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

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

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

    if -3.74083005502277e-271 < z < 3.761519737827246e-224

    1. Initial program 21.6

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

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

    if 4.956742987442585e+22 < z

    1. Initial program 13.4

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{x}{\sqrt[3]{z}}\]
    9. Using strategy rm
    10. Applied frac-times6.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.74083005502277 \cdot 10^{-271}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;z \le 3.761519737827246 \cdot 10^{-224}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;z \le 4.956742987442585 \cdot 10^{+22}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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