Average Error: 14.1 → 2.4
Time: 1.7s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -3.00847826157384981 \cdot 10^{150} \lor \neg \left(\frac{y}{z} \le -9.59916746614835709 \cdot 10^{-156} \lor \neg \left(\frac{y}{z} \le 1.38338 \cdot 10^{-322}\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} \le -3.00847826157384981 \cdot 10^{150} \lor \neg \left(\frac{y}{z} \le -9.59916746614835709 \cdot 10^{-156} \lor \neg \left(\frac{y}{z} \le 1.38338 \cdot 10^{-322}\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 r64307 = x;
        double r64308 = y;
        double r64309 = z;
        double r64310 = r64308 / r64309;
        double r64311 = t;
        double r64312 = r64310 * r64311;
        double r64313 = r64312 / r64311;
        double r64314 = r64307 * r64313;
        return r64314;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r64315 = y;
        double r64316 = z;
        double r64317 = r64315 / r64316;
        double r64318 = -3.0084782615738498e+150;
        bool r64319 = r64317 <= r64318;
        double r64320 = -9.599167466148357e-156;
        bool r64321 = r64317 <= r64320;
        double r64322 = 1.3833838083555e-322;
        bool r64323 = r64317 <= r64322;
        double r64324 = !r64323;
        bool r64325 = r64321 || r64324;
        double r64326 = !r64325;
        bool r64327 = r64319 || r64326;
        double r64328 = x;
        double r64329 = r64328 * r64315;
        double r64330 = r64329 / r64316;
        double r64331 = r64316 / r64315;
        double r64332 = r64328 / r64331;
        double r64333 = r64327 ? r64330 : r64332;
        return r64333;
}

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) < -3.0084782615738498e+150 or -9.599167466148357e-156 < (/ y z) < 1.3833838083555e-322

    1. Initial program 21.1

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

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

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

    if -3.0084782615738498e+150 < (/ y z) < -9.599167466148357e-156 or 1.3833838083555e-322 < (/ y z)

    1. Initial program 10.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -3.00847826157384981 \cdot 10^{150} \lor \neg \left(\frac{y}{z} \le -9.59916746614835709 \cdot 10^{-156} \lor \neg \left(\frac{y}{z} \le 1.38338 \cdot 10^{-322}\right)\right):\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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