Average Error: 14.7 → 0.8
Time: 30.4s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.777824700739059504027072604237357294271 \cdot 10^{-189}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 6.194701076531514820787324531303599279908 \cdot 10^{-141}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 4.487328446405641062208224523193589026226 \cdot 10^{149}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 4.487328446405641062208224523193589026226 \cdot 10^{149}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r358045 = x;
        double r358046 = y;
        double r358047 = z;
        double r358048 = r358046 / r358047;
        double r358049 = t;
        double r358050 = r358048 * r358049;
        double r358051 = r358050 / r358049;
        double r358052 = r358045 * r358051;
        return r358052;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r358053 = y;
        double r358054 = z;
        double r358055 = r358053 / r358054;
        double r358056 = -inf.0;
        bool r358057 = r358055 <= r358056;
        double r358058 = x;
        double r358059 = r358058 / r358054;
        double r358060 = r358053 * r358059;
        double r358061 = -1.7778247007390595e-189;
        bool r358062 = r358055 <= r358061;
        double r358063 = r358055 * r358058;
        double r358064 = 6.194701076531515e-141;
        bool r358065 = r358055 <= r358064;
        double r358066 = r358058 * r358053;
        double r358067 = r358066 / r358054;
        double r358068 = 4.487328446405641e+149;
        bool r358069 = r358055 <= r358068;
        double r358070 = r358069 ? r358063 : r358060;
        double r358071 = r358065 ? r358067 : r358070;
        double r358072 = r358062 ? r358063 : r358071;
        double r358073 = r358057 ? r358060 : r358072;
        return r358073;
}

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.7
Target1.4
Herbie0.8
\[\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 3 regimes
  2. if (/ y z) < -inf.0 or 4.487328446405641e+149 < (/ y z)

    1. Initial program 41.5

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

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

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

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

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

    if -inf.0 < (/ y z) < -1.7778247007390595e-189 or 6.194701076531515e-141 < (/ y z) < 4.487328446405641e+149

    1. Initial program 7.9

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

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

    if -1.7778247007390595e-189 < (/ y z) < 6.194701076531515e-141

    1. Initial program 17.3

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

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

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right) \cdot \left(\sqrt[3]{\frac{y}{z}} \cdot x\right)}\]
    6. Using strategy rm
    7. Applied cbrt-div9.4

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

      \[\leadsto \left(\sqrt[3]{\frac{y}{z}} \cdot \sqrt[3]{\frac{y}{z}}\right) \cdot \color{blue}{\frac{\sqrt[3]{y} \cdot x}{\sqrt[3]{z}}}\]
    9. Applied cbrt-div9.6

      \[\leadsto \left(\sqrt[3]{\frac{y}{z}} \cdot \color{blue}{\frac{\sqrt[3]{y}}{\sqrt[3]{z}}}\right) \cdot \frac{\sqrt[3]{y} \cdot x}{\sqrt[3]{z}}\]
    10. Applied cbrt-div1.8

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{y} \cdot \sqrt[3]{y}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}} \cdot \frac{\sqrt[3]{y} \cdot x}{\sqrt[3]{z}}\]
    12. Applied frac-times2.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.777824700739059504027072604237357294271 \cdot 10^{-189}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 6.194701076531514820787324531303599279908 \cdot 10^{-141}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 4.487328446405641062208224523193589026226 \cdot 10^{149}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"
  :precision binary64

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