Average Error: 14.3 → 0.3
Time: 13.3s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -5.49778287371169 \cdot 10^{+261}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.983516013696309 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 9.35914650043368 \cdot 10^{-309}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 8.460748976825988 \cdot 10^{+248}:\\ \;\;\;\;\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}\;\frac{y}{z} \le -5.49778287371169 \cdot 10^{+261}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 8.460748976825988 \cdot 10^{+248}:\\
\;\;\;\;\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 r30646718 = x;
        double r30646719 = y;
        double r30646720 = z;
        double r30646721 = r30646719 / r30646720;
        double r30646722 = t;
        double r30646723 = r30646721 * r30646722;
        double r30646724 = r30646723 / r30646722;
        double r30646725 = r30646718 * r30646724;
        return r30646725;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r30646726 = y;
        double r30646727 = z;
        double r30646728 = r30646726 / r30646727;
        double r30646729 = -5.49778287371169e+261;
        bool r30646730 = r30646728 <= r30646729;
        double r30646731 = x;
        double r30646732 = r30646731 / r30646727;
        double r30646733 = r30646726 * r30646732;
        double r30646734 = -1.983516013696309e-226;
        bool r30646735 = r30646728 <= r30646734;
        double r30646736 = r30646727 / r30646726;
        double r30646737 = r30646731 / r30646736;
        double r30646738 = 9.35914650043368e-309;
        bool r30646739 = r30646728 <= r30646738;
        double r30646740 = 8.460748976825988e+248;
        bool r30646741 = r30646728 <= r30646740;
        double r30646742 = r30646731 * r30646726;
        double r30646743 = r30646742 / r30646727;
        double r30646744 = r30646741 ? r30646737 : r30646743;
        double r30646745 = r30646739 ? r30646733 : r30646744;
        double r30646746 = r30646735 ? r30646737 : r30646745;
        double r30646747 = r30646730 ? r30646733 : r30646746;
        return r30646747;
}

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.3
Target1.7
Herbie0.3
\[\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 z) < -5.49778287371169e+261 or -1.983516013696309e-226 < (/ y z) < 9.35914650043368e-309

    1. Initial program 23.3

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

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

    if -5.49778287371169e+261 < (/ y z) < -1.983516013696309e-226 or 9.35914650043368e-309 < (/ y z) < 8.460748976825988e+248

    1. Initial program 9.5

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot y\right)} \cdot \frac{\sqrt[3]{x}}{z}\]
    9. Using strategy rm
    10. Applied associate-*r/9.0

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

      \[\leadsto \frac{\color{blue}{x \cdot y}}{z}\]
    12. Using strategy rm
    13. Applied associate-/l*0.2

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

    if 8.460748976825988e+248 < (/ y z)

    1. Initial program 47.6

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

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

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

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

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

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

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot y\right)} \cdot \frac{\sqrt[3]{x}}{z}\]
    9. Using strategy rm
    10. Applied associate-*r/1.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -5.49778287371169 \cdot 10^{+261}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.983516013696309 \cdot 10^{-226}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 9.35914650043368 \cdot 10^{-309}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 8.460748976825988 \cdot 10^{+248}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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