Average Error: 14.1 → 6.1
Time: 13.7s
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 r29468911 = x;
        double r29468912 = y;
        double r29468913 = z;
        double r29468914 = r29468912 / r29468913;
        double r29468915 = t;
        double r29468916 = r29468914 * r29468915;
        double r29468917 = r29468916 / r29468915;
        double r29468918 = r29468911 * r29468917;
        return r29468918;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r29468919 = z;
        double r29468920 = -3.74083005502277e-271;
        bool r29468921 = r29468919 <= r29468920;
        double r29468922 = x;
        double r29468923 = y;
        double r29468924 = r29468919 / r29468923;
        double r29468925 = r29468922 / r29468924;
        double r29468926 = 3.761519737827246e-224;
        bool r29468927 = r29468919 <= r29468926;
        double r29468928 = r29468922 / r29468919;
        double r29468929 = r29468923 * r29468928;
        double r29468930 = 4.956742987442585e+22;
        bool r29468931 = r29468919 <= r29468930;
        double r29468932 = r29468922 * r29468923;
        double r29468933 = r29468932 / r29468919;
        double r29468934 = r29468931 ? r29468925 : r29468933;
        double r29468935 = r29468927 ? r29468929 : r29468934;
        double r29468936 = r29468921 ? r29468925 : r29468935;
        return r29468936;
}

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 associate-*r/6.2

      \[\leadsto \color{blue}{\frac{y \cdot x}{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)))