Average Error: 14.6 → 1.7
Time: 20.9s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -9.764747372949971 \cdot 10^{-270}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.6772801671161767 \cdot 10^{-229}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r3648154 = x;
        double r3648155 = y;
        double r3648156 = z;
        double r3648157 = r3648155 / r3648156;
        double r3648158 = t;
        double r3648159 = r3648157 * r3648158;
        double r3648160 = r3648159 / r3648158;
        double r3648161 = r3648154 * r3648160;
        return r3648161;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r3648162 = y;
        double r3648163 = z;
        double r3648164 = r3648162 / r3648163;
        double r3648165 = -inf.0;
        bool r3648166 = r3648164 <= r3648165;
        double r3648167 = x;
        double r3648168 = r3648167 / r3648163;
        double r3648169 = r3648162 * r3648168;
        double r3648170 = -9.764747372949971e-270;
        bool r3648171 = r3648164 <= r3648170;
        double r3648172 = r3648164 * r3648167;
        double r3648173 = 2.6772801671161767e-229;
        bool r3648174 = r3648164 <= r3648173;
        double r3648175 = r3648174 ? r3648169 : r3648172;
        double r3648176 = r3648171 ? r3648172 : r3648175;
        double r3648177 = r3648166 ? r3648169 : r3648176;
        return r3648177;
}

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 -9.764747372949971e-270 < (/ y z) < 2.6772801671161767e-229

    1. Initial program 22.7

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

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

    if -inf.0 < (/ y z) < -9.764747372949971e-270 or 2.6772801671161767e-229 < (/ y z)

    1. Initial program 12.0

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -9.764747372949971 \cdot 10^{-270}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.6772801671161767 \cdot 10^{-229}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

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