Average Error: 15.1 → 6.0
Time: 13.6s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.456893094179093804320322909204701959778 \cdot 10^{-222}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \le -1.998153801628733335171500404420370674566 \cdot 10^{-247}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;z \le 8.447680461540099603836085647567339379828 \cdot 10^{-193}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \le 1.21944214684399880068881121045408236628 \cdot 10^{120}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \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 -5.456893094179093804320322909204701959778 \cdot 10^{-222}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

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

\mathbf{elif}\;z \le 1.21944214684399880068881121045408236628 \cdot 10^{120}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r29883528 = x;
        double r29883529 = y;
        double r29883530 = z;
        double r29883531 = r29883529 / r29883530;
        double r29883532 = t;
        double r29883533 = r29883531 * r29883532;
        double r29883534 = r29883533 / r29883532;
        double r29883535 = r29883528 * r29883534;
        return r29883535;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r29883536 = z;
        double r29883537 = -5.456893094179094e-222;
        bool r29883538 = r29883536 <= r29883537;
        double r29883539 = x;
        double r29883540 = y;
        double r29883541 = r29883539 * r29883540;
        double r29883542 = r29883541 / r29883536;
        double r29883543 = -1.9981538016287333e-247;
        bool r29883544 = r29883536 <= r29883543;
        double r29883545 = r29883536 / r29883539;
        double r29883546 = r29883540 / r29883545;
        double r29883547 = 8.4476804615401e-193;
        bool r29883548 = r29883536 <= r29883547;
        double r29883549 = 1.2194421468439988e+120;
        bool r29883550 = r29883536 <= r29883549;
        double r29883551 = r29883550 ? r29883546 : r29883542;
        double r29883552 = r29883548 ? r29883542 : r29883551;
        double r29883553 = r29883544 ? r29883546 : r29883552;
        double r29883554 = r29883538 ? r29883542 : r29883553;
        return r29883554;
}

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

Original15.1
Target1.8
Herbie6.0
\[\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 2 regimes
  2. if z < -5.456893094179094e-222 or -1.9981538016287333e-247 < z < 8.4476804615401e-193 or 1.2194421468439988e+120 < z

    1. Initial program 15.2

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

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

    if -5.456893094179094e-222 < z < -1.9981538016287333e-247 or 8.4476804615401e-193 < z < 1.2194421468439988e+120

    1. Initial program 14.8

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

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

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

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

      \[\leadsto \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{\color{blue}{1 \cdot z}}}\]
    8. Applied cbrt-prod5.9

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

      \[\leadsto \frac{\color{blue}{1 \cdot \frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}}{\sqrt[3]{1} \cdot \sqrt[3]{z}}\]
    10. Applied times-frac5.9

      \[\leadsto \color{blue}{\frac{1}{\sqrt[3]{1}} \cdot \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}}\]
    11. Simplified5.9

      \[\leadsto \color{blue}{1} \cdot \frac{\frac{x \cdot y}{\sqrt[3]{z} \cdot \sqrt[3]{z}}}{\sqrt[3]{z}}\]
    12. Simplified3.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.456893094179093804320322909204701959778 \cdot 10^{-222}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \le -1.998153801628733335171500404420370674566 \cdot 10^{-247}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;z \le 8.447680461540099603836085647567339379828 \cdot 10^{-193}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;z \le 1.21944214684399880068881121045408236628 \cdot 10^{120}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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