Average Error: 15.0 → 1.6
Time: 3.5s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty \lor \neg \left(\frac{y}{z} \le -4.63381832549882 \cdot 10^{-264} \lor \neg \left(\frac{y}{z} \le 7.18495937326560576 \cdot 10^{-264}\right)\right):\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty \lor \neg \left(\frac{y}{z} \le -4.63381832549882 \cdot 10^{-264} \lor \neg \left(\frac{y}{z} \le 7.18495937326560576 \cdot 10^{-264}\right)\right):\\
\;\;\;\;\frac{x \cdot y}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r121556 = x;
        double r121557 = y;
        double r121558 = z;
        double r121559 = r121557 / r121558;
        double r121560 = t;
        double r121561 = r121559 * r121560;
        double r121562 = r121561 / r121560;
        double r121563 = r121556 * r121562;
        return r121563;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r121564 = y;
        double r121565 = z;
        double r121566 = r121564 / r121565;
        double r121567 = -inf.0;
        bool r121568 = r121566 <= r121567;
        double r121569 = -4.63381832549882e-264;
        bool r121570 = r121566 <= r121569;
        double r121571 = 7.184959373265606e-264;
        bool r121572 = r121566 <= r121571;
        double r121573 = !r121572;
        bool r121574 = r121570 || r121573;
        double r121575 = !r121574;
        bool r121576 = r121568 || r121575;
        double r121577 = x;
        double r121578 = r121577 * r121564;
        double r121579 = r121578 / r121565;
        double r121580 = r121565 / r121564;
        double r121581 = r121577 / r121580;
        double r121582 = r121576 ? r121579 : r121581;
        return r121582;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ y z) < -inf.0 or -4.63381832549882e-264 < (/ y z) < 7.184959373265606e-264

    1. Initial program 24.0

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

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

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

    if -inf.0 < (/ y z) < -4.63381832549882e-264 or 7.184959373265606e-264 < (/ y z)

    1. Initial program 12.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty \lor \neg \left(\frac{y}{z} \le -4.63381832549882 \cdot 10^{-264} \lor \neg \left(\frac{y}{z} \le 7.18495937326560576 \cdot 10^{-264}\right)\right):\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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