Average Error: 14.7 → 0.3
Time: 9.0s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.575588880456927846517204610144689059531 \cdot 10^{-286}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\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} \le -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\
\;\;\;\;\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 r577098 = x;
        double r577099 = y;
        double r577100 = z;
        double r577101 = r577099 / r577100;
        double r577102 = t;
        double r577103 = r577101 * r577102;
        double r577104 = r577103 / r577102;
        double r577105 = r577098 * r577104;
        return r577105;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r577106 = y;
        double r577107 = z;
        double r577108 = r577106 / r577107;
        double r577109 = -6.295445244155452e+285;
        bool r577110 = r577108 <= r577109;
        double r577111 = x;
        double r577112 = r577111 * r577106;
        double r577113 = 1.0;
        double r577114 = r577113 / r577107;
        double r577115 = r577112 * r577114;
        double r577116 = -1.5755888804569278e-286;
        bool r577117 = r577108 <= r577116;
        double r577118 = r577107 / r577106;
        double r577119 = r577111 / r577118;
        double r577120 = 3.757059281014894e-220;
        bool r577121 = r577108 <= r577120;
        double r577122 = r577112 / r577107;
        double r577123 = 1.409130514825537e+217;
        bool r577124 = r577108 <= r577123;
        double r577125 = r577108 * r577111;
        double r577126 = r577111 / r577107;
        double r577127 = r577106 * r577126;
        double r577128 = r577124 ? r577125 : r577127;
        double r577129 = r577121 ? r577122 : r577128;
        double r577130 = r577117 ? r577119 : r577129;
        double r577131 = r577110 ? r577115 : r577130;
        return r577131;
}

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.6
Herbie0.3
\[\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 5 regimes
  2. if (/ y z) < -6.295445244155452e+285

    1. Initial program 58.1

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

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

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

    if -6.295445244155452e+285 < (/ y z) < -1.5755888804569278e-286

    1. Initial program 10.7

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

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

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

    if -1.5755888804569278e-286 < (/ y z) < 3.757059281014894e-220

    1. Initial program 18.8

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied associate-/l*15.6

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y}}}\]
    5. Taylor expanded around 0 0.3

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

    if 3.757059281014894e-220 < (/ y z) < 1.409130514825537e+217

    1. Initial program 8.1

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

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

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

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    6. Simplified0.2

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

    if 1.409130514825537e+217 < (/ y z)

    1. Initial program 44.0

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Taylor expanded around 0 1.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -6.29544524415545219149038523268139908958 \cdot 10^{285}:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.575588880456927846517204610144689059531 \cdot 10^{-286}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

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