Average Error: 14.7 → 0.3
Time: 9.8s
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 -2.260559411855018598510891206887091885181 \cdot 10^{-253}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{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 -2.260559411855018598510891206887091885181 \cdot 10^{-253}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r56197 = x;
        double r56198 = y;
        double r56199 = z;
        double r56200 = r56198 / r56199;
        double r56201 = t;
        double r56202 = r56200 * r56201;
        double r56203 = r56202 / r56201;
        double r56204 = r56197 * r56203;
        return r56204;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r56205 = y;
        double r56206 = z;
        double r56207 = r56205 / r56206;
        double r56208 = -inf.0;
        bool r56209 = r56207 <= r56208;
        double r56210 = x;
        double r56211 = r56210 * r56205;
        double r56212 = 1.0;
        double r56213 = r56212 / r56206;
        double r56214 = r56211 * r56213;
        double r56215 = -2.2605594118550186e-253;
        bool r56216 = r56207 <= r56215;
        double r56217 = r56207 * r56210;
        double r56218 = 3.757059281014894e-220;
        bool r56219 = r56207 <= r56218;
        double r56220 = r56211 / r56206;
        double r56221 = 1.409130514825537e+217;
        bool r56222 = r56207 <= r56221;
        double r56223 = r56210 / r56206;
        double r56224 = r56205 * r56223;
        double r56225 = r56222 ? r56217 : r56224;
        double r56226 = r56219 ? r56220 : r56225;
        double r56227 = r56216 ? r56217 : r56226;
        double r56228 = r56209 ? r56214 : r56227;
        return r56228;
}

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. Simplified0.3

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

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

    if -inf.0 < (/ y z) < -2.2605594118550186e-253 or 3.757059281014894e-220 < (/ y z) < 1.409130514825537e+217

    1. Initial program 9.5

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.5

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    5. Applied times-frac0.2

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

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

    if -2.2605594118550186e-253 < (/ y z) < 3.757059281014894e-220

    1. Initial program 18.7

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
    5. Using strategy rm
    6. Applied associate-*r/0.4

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

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

    if 1.409130514825537e+217 < (/ y z)

    1. Initial program 44.0

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

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

      \[\leadsto \color{blue}{\left(x \cdot y\right) \cdot \frac{1}{z}}\]
    5. Using strategy rm
    6. Applied associate-*r/1.0

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

      \[\leadsto \frac{\color{blue}{y \cdot x}}{z}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity1.0

      \[\leadsto \frac{y \cdot x}{\color{blue}{1 \cdot z}}\]
    10. Applied times-frac0.4

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

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

    \[\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 -2.260559411855018598510891206887091885181 \cdot 10^{-253}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 3.757059281014894097749857788400547545613 \cdot 10^{-220}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 1.409130514825537046443418609777720419861 \cdot 10^{217}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \end{array}\]

Reproduce

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