Average Error: 14.8 → 0.8
Time: 2.9s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.03192616381755189 \cdot 10^{-277}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 7.34626099988 \cdot 10^{-313}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.1777827215712954 \cdot 10^{98}:\\ \;\;\;\;\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:\\
\;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\

\mathbf{elif}\;\frac{y}{z} \le -1.03192616381755189 \cdot 10^{-277}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 7.34626099988 \cdot 10^{-313}:\\
\;\;\;\;\frac{x \cdot y}{z}\\

\mathbf{elif}\;\frac{y}{z} \le 2.1777827215712954 \cdot 10^{98}:\\
\;\;\;\;\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 r147766 = x;
        double r147767 = y;
        double r147768 = z;
        double r147769 = r147767 / r147768;
        double r147770 = t;
        double r147771 = r147769 * r147770;
        double r147772 = r147771 / r147770;
        double r147773 = r147766 * r147772;
        return r147773;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r147774 = y;
        double r147775 = z;
        double r147776 = r147774 / r147775;
        double r147777 = -inf.0;
        bool r147778 = r147776 <= r147777;
        double r147779 = x;
        double r147780 = r147779 * r147774;
        double r147781 = 1.0;
        double r147782 = r147781 / r147775;
        double r147783 = r147780 * r147782;
        double r147784 = -1.0319261638175519e-277;
        bool r147785 = r147776 <= r147784;
        double r147786 = r147779 * r147776;
        double r147787 = 7.3462609998833e-313;
        bool r147788 = r147776 <= r147787;
        double r147789 = r147780 / r147775;
        double r147790 = 2.1777827215712954e+98;
        bool r147791 = r147776 <= r147790;
        double r147792 = r147775 / r147774;
        double r147793 = r147779 / r147792;
        double r147794 = r147791 ? r147793 : r147789;
        double r147795 = r147788 ? r147789 : r147794;
        double r147796 = r147785 ? r147786 : r147795;
        double r147797 = r147778 ? r147783 : r147796;
        return r147797;
}

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 4 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 div-inv64.0

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

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

    if -inf.0 < (/ y z) < -1.0319261638175519e-277

    1. Initial program 11.1

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

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

    if -1.0319261638175519e-277 < (/ y z) < 7.3462609998833e-313 or 2.1777827215712954e+98 < (/ y z)

    1. Initial program 23.4

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

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

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

    if 7.3462609998833e-313 < (/ y z) < 2.1777827215712954e+98

    1. Initial program 8.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.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\left(x \cdot y\right) \cdot \frac{1}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -1.03192616381755189 \cdot 10^{-277}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 7.34626099988 \cdot 10^{-313}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 2.1777827215712954 \cdot 10^{98}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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