Average Error: 14.6 → 0.5
Time: 20.5s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le -7.90874680156662538 \cdot 10^{-239} \lor \neg \left(\frac{y}{z} \le 3.9139383207105451 \cdot 10^{-281}\right) \land \frac{y}{z} \le 1.9001415219657884 \cdot 10^{134}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\

\mathbf{elif}\;\frac{y}{z} \le -7.90874680156662538 \cdot 10^{-239} \lor \neg \left(\frac{y}{z} \le 3.9139383207105451 \cdot 10^{-281}\right) \land \frac{y}{z} \le 1.9001415219657884 \cdot 10^{134}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r132647 = x;
        double r132648 = y;
        double r132649 = z;
        double r132650 = r132648 / r132649;
        double r132651 = t;
        double r132652 = r132650 * r132651;
        double r132653 = r132652 / r132651;
        double r132654 = r132647 * r132653;
        return r132654;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r132655 = y;
        double r132656 = z;
        double r132657 = r132655 / r132656;
        double r132658 = -inf.0;
        bool r132659 = r132657 <= r132658;
        double r132660 = 1.0;
        double r132661 = x;
        double r132662 = r132656 / r132661;
        double r132663 = r132662 / r132655;
        double r132664 = r132660 / r132663;
        double r132665 = -7.908746801566625e-239;
        bool r132666 = r132657 <= r132665;
        double r132667 = 3.913938320710545e-281;
        bool r132668 = r132657 <= r132667;
        double r132669 = !r132668;
        double r132670 = 1.9001415219657884e+134;
        bool r132671 = r132657 <= r132670;
        bool r132672 = r132669 && r132671;
        bool r132673 = r132666 || r132672;
        double r132674 = r132656 / r132655;
        double r132675 = r132661 / r132674;
        double r132676 = r132661 * r132655;
        double r132677 = r132676 / r132656;
        double r132678 = r132673 ? r132675 : r132677;
        double r132679 = r132659 ? r132664 : r132678;
        return r132679;
}

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 3 regimes
  2. if (/ y z) < -inf.0

    1. Initial program 64.0

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    5. Using strategy rm
    6. Applied clear-num0.4

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    7. Simplified0.4

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

    if -inf.0 < (/ y z) < -7.908746801566625e-239 or 3.913938320710545e-281 < (/ y z) < 1.9001415219657884e+134

    1. Initial program 9.2

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

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

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

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

    if -7.908746801566625e-239 < (/ y z) < 3.913938320710545e-281 or 1.9001415219657884e+134 < (/ y z)

    1. Initial program 22.7

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\frac{1}{\frac{\frac{z}{x}}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le -7.90874680156662538 \cdot 10^{-239} \lor \neg \left(\frac{y}{z} \le 3.9139383207105451 \cdot 10^{-281}\right) \land \frac{y}{z} \le 1.9001415219657884 \cdot 10^{134}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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