Average Error: 15.1 → 6.1
Time: 8.6s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.456893094179093804320322909204701959778 \cdot 10^{-222} \lor \neg \left(z \le -1.998153801628733335171500404420370674566 \cdot 10^{-247} \lor \neg \left(z \le 4.05788010217845352231803013478156312545 \cdot 10^{-197}\right) \land z \le 1.296418022463658713943633924036189200527 \cdot 10^{117}\right):\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;z \le -5.456893094179093804320322909204701959778 \cdot 10^{-222} \lor \neg \left(z \le -1.998153801628733335171500404420370674566 \cdot 10^{-247} \lor \neg \left(z \le 4.05788010217845352231803013478156312545 \cdot 10^{-197}\right) \land z \le 1.296418022463658713943633924036189200527 \cdot 10^{117}\right):\\
\;\;\;\;\frac{y \cdot x}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r403260 = x;
        double r403261 = y;
        double r403262 = z;
        double r403263 = r403261 / r403262;
        double r403264 = t;
        double r403265 = r403263 * r403264;
        double r403266 = r403265 / r403264;
        double r403267 = r403260 * r403266;
        return r403267;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r403268 = z;
        double r403269 = -5.456893094179094e-222;
        bool r403270 = r403268 <= r403269;
        double r403271 = -1.9981538016287333e-247;
        bool r403272 = r403268 <= r403271;
        double r403273 = 4.0578801021784535e-197;
        bool r403274 = r403268 <= r403273;
        double r403275 = !r403274;
        double r403276 = 1.2964180224636587e+117;
        bool r403277 = r403268 <= r403276;
        bool r403278 = r403275 && r403277;
        bool r403279 = r403272 || r403278;
        double r403280 = !r403279;
        bool r403281 = r403270 || r403280;
        double r403282 = y;
        double r403283 = x;
        double r403284 = r403282 * r403283;
        double r403285 = r403284 / r403268;
        double r403286 = r403283 / r403268;
        double r403287 = 1.0;
        double r403288 = r403287 / r403282;
        double r403289 = r403286 / r403288;
        double r403290 = r403281 ? r403285 : r403289;
        return r403290;
}

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.1
\[\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 < 4.0578801021784535e-197 or 1.2964180224636587e+117 < 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}}\]
    3. Using strategy rm
    4. Applied associate-/l*6.7

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    5. Using strategy rm
    6. Applied clear-num7.1

      \[\leadsto \color{blue}{\frac{1}{\frac{\frac{z}{y}}{x}}}\]
    7. Simplified7.1

      \[\leadsto \frac{1}{\color{blue}{\frac{z}{x \cdot y}}}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity7.1

      \[\leadsto \frac{1}{\frac{\color{blue}{1 \cdot z}}{x \cdot y}}\]
    10. Applied times-frac7.2

      \[\leadsto \frac{1}{\color{blue}{\frac{1}{x} \cdot \frac{z}{y}}}\]
    11. Applied add-cube-cbrt7.2

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{1}{x}} \cdot \frac{\sqrt[3]{1}}{\frac{z}{y}}}\]
    13. Simplified7.1

      \[\leadsto \color{blue}{x} \cdot \frac{\sqrt[3]{1}}{\frac{z}{y}}\]
    14. Simplified6.7

      \[\leadsto x \cdot \color{blue}{\frac{1 \cdot y}{z}}\]
    15. Using strategy rm
    16. Applied *-un-lft-identity6.7

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

      \[\leadsto \color{blue}{1 \cdot \left(x \cdot \frac{1 \cdot y}{z}\right)}\]
    18. Simplified6.7

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

    if -5.456893094179094e-222 < z < -1.9981538016287333e-247 or 4.0578801021784535e-197 < z < 1.2964180224636587e+117

    1. Initial program 15.0

      \[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 associate-/l*4.5

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    5. Using strategy rm
    6. Applied div-inv4.6

      \[\leadsto \frac{x}{\color{blue}{z \cdot \frac{1}{y}}}\]
    7. Applied associate-/r*4.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -5.456893094179093804320322909204701959778 \cdot 10^{-222} \lor \neg \left(z \le -1.998153801628733335171500404420370674566 \cdot 10^{-247} \lor \neg \left(z \le 4.05788010217845352231803013478156312545 \cdot 10^{-197}\right) \land z \le 1.296418022463658713943633924036189200527 \cdot 10^{117}\right):\\ \;\;\;\;\frac{y \cdot x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 +o rules:numerics
(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)))