Average Error: 14.8 → 1.8
Time: 3.5s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -7.7151331283821803 \cdot 10^{306} \lor \neg \left(\frac{y}{z} \le -6.11823401185594017 \cdot 10^{-307} \lor \neg \left(\frac{y}{z} \le 1.1616010043381929 \cdot 10^{-258}\right)\right):\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -7.7151331283821803 \cdot 10^{306} \lor \neg \left(\frac{y}{z} \le -6.11823401185594017 \cdot 10^{-307} \lor \neg \left(\frac{y}{z} \le 1.1616010043381929 \cdot 10^{-258}\right)\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r93234 = x;
        double r93235 = y;
        double r93236 = z;
        double r93237 = r93235 / r93236;
        double r93238 = t;
        double r93239 = r93237 * r93238;
        double r93240 = r93239 / r93238;
        double r93241 = r93234 * r93240;
        return r93241;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r93242 = y;
        double r93243 = z;
        double r93244 = r93242 / r93243;
        double r93245 = -7.71513312838218e+306;
        bool r93246 = r93244 <= r93245;
        double r93247 = -6.11823401185594e-307;
        bool r93248 = r93244 <= r93247;
        double r93249 = 1.161601004338193e-258;
        bool r93250 = r93244 <= r93249;
        double r93251 = !r93250;
        bool r93252 = r93248 || r93251;
        double r93253 = !r93252;
        bool r93254 = r93246 || r93253;
        double r93255 = x;
        double r93256 = r93255 * r93242;
        double r93257 = 1.0;
        double r93258 = r93257 / r93243;
        double r93259 = r93256 * r93258;
        double r93260 = r93255 * r93244;
        double r93261 = r93254 ? r93259 : r93260;
        return r93261;
}

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) < -7.71513312838218e+306 or -6.11823401185594e-307 < (/ y z) < 1.161601004338193e-258

    1. Initial program 24.4

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

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

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

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

    if -7.71513312838218e+306 < (/ y z) < -6.11823401185594e-307 or 1.161601004338193e-258 < (/ y z)

    1. Initial program 12.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -7.7151331283821803 \cdot 10^{306} \lor \neg \left(\frac{y}{z} \le -6.11823401185594017 \cdot 10^{-307} \lor \neg \left(\frac{y}{z} \le 1.1616010043381929 \cdot 10^{-258}\right)\right):\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +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)))