Average Error: 14.7 → 0.8
Time: 27.6s
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 r405178 = x;
        double r405179 = y;
        double r405180 = z;
        double r405181 = r405179 / r405180;
        double r405182 = t;
        double r405183 = r405181 * r405182;
        double r405184 = r405183 / r405182;
        double r405185 = r405178 * r405184;
        return r405185;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r405186 = y;
        double r405187 = z;
        double r405188 = r405186 / r405187;
        double r405189 = -inf.0;
        bool r405190 = r405188 <= r405189;
        double r405191 = x;
        double r405192 = r405191 / r405187;
        double r405193 = r405186 * r405192;
        double r405194 = -1.7778247007390595e-189;
        bool r405195 = r405188 <= r405194;
        double r405196 = r405188 * r405191;
        double r405197 = 6.194701076531515e-141;
        bool r405198 = r405188 <= r405197;
        double r405199 = r405191 * r405186;
        double r405200 = r405199 / r405187;
        double r405201 = 4.487328446405641e+149;
        bool r405202 = r405188 <= r405201;
        double r405203 = r405202 ? r405196 : r405193;
        double r405204 = r405198 ? r405200 : r405203;
        double r405205 = r405195 ? r405196 : r405204;
        double r405206 = r405190 ? r405193 : r405205;
        return r405206;
}

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 div-inv9.0

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

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

      \[\leadsto y \cdot \color{blue}{\frac{x}{z}}\]
    7. Using strategy rm
    8. Applied associate-*r/1.3

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}}\]
    9. Simplified1.3

      \[\leadsto \frac{\color{blue}{x \cdot y}}{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 
(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)))