Average Error: 14.4 → 2.0
Time: 5.9s
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 -9.408990596506298 \cdot 10^{-174}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \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 -9.408990596506298 \cdot 10^{-174}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

\mathbf{elif}\;\frac{y}{z} \le -0.0:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r10984761 = x;
        double r10984762 = y;
        double r10984763 = z;
        double r10984764 = r10984762 / r10984763;
        double r10984765 = t;
        double r10984766 = r10984764 * r10984765;
        double r10984767 = r10984766 / r10984765;
        double r10984768 = r10984761 * r10984767;
        return r10984768;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r10984769 = y;
        double r10984770 = z;
        double r10984771 = r10984769 / r10984770;
        double r10984772 = -inf.0;
        bool r10984773 = r10984771 <= r10984772;
        double r10984774 = x;
        double r10984775 = r10984774 / r10984770;
        double r10984776 = r10984769 * r10984775;
        double r10984777 = -9.408990596506298e-174;
        bool r10984778 = r10984771 <= r10984777;
        double r10984779 = r10984771 * r10984774;
        double r10984780 = -0.0;
        bool r10984781 = r10984771 <= r10984780;
        double r10984782 = r10984770 / r10984774;
        double r10984783 = r10984769 / r10984782;
        double r10984784 = r10984781 ? r10984783 : r10984779;
        double r10984785 = r10984778 ? r10984779 : r10984784;
        double r10984786 = r10984773 ? r10984776 : r10984785;
        return r10984786;
}

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.4
Target1.4
Herbie2.0
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045 \cdot 10^{+245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.907522236933906 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.0087180502407133 \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

    1. Initial program 60.1

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

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

    if -inf.0 < (/ y z) < -9.408990596506298e-174 or -0.0 < (/ y z)

    1. Initial program 12.0

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}}\]
    5. Using strategy rm
    6. Applied associate-/l*7.7

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

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

    if -9.408990596506298e-174 < (/ y z) < -0.0

    1. Initial program 17.7

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

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

      \[\leadsto \color{blue}{\frac{y \cdot x}{z}}\]
    5. Using strategy rm
    6. Applied associate-/l*0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -9.408990596506298 \cdot 10^{-174}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

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