Average Error: 14.3 → 2.0
Time: 20.1s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.6142066513649255 \cdot 10^{-137}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 1.9933305190113944 \cdot 10^{-307}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 9.807437992397751 \cdot 10^{+137}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -1.6142066513649255 \cdot 10^{-137}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\mathbf{elif}\;\frac{y}{z} \le 9.807437992397751 \cdot 10^{+137}:\\
\;\;\;\;\frac{y}{z} \cdot x\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r4257529 = x;
        double r4257530 = y;
        double r4257531 = z;
        double r4257532 = r4257530 / r4257531;
        double r4257533 = t;
        double r4257534 = r4257532 * r4257533;
        double r4257535 = r4257534 / r4257533;
        double r4257536 = r4257529 * r4257535;
        return r4257536;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r4257537 = y;
        double r4257538 = z;
        double r4257539 = r4257537 / r4257538;
        double r4257540 = -1.6142066513649255e-137;
        bool r4257541 = r4257539 <= r4257540;
        double r4257542 = x;
        double r4257543 = r4257539 * r4257542;
        double r4257544 = 1.9933305190113944e-307;
        bool r4257545 = r4257539 <= r4257544;
        double r4257546 = r4257542 * r4257537;
        double r4257547 = r4257546 / r4257538;
        double r4257548 = 9.807437992397751e+137;
        bool r4257549 = r4257539 <= r4257548;
        double r4257550 = r4257542 / r4257538;
        double r4257551 = r4257550 * r4257537;
        double r4257552 = r4257549 ? r4257543 : r4257551;
        double r4257553 = r4257545 ? r4257547 : r4257552;
        double r4257554 = r4257541 ? r4257543 : r4257553;
        return r4257554;
}

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) < -1.6142066513649255e-137 or 1.9933305190113944e-307 < (/ y z) < 9.807437992397751e+137

    1. Initial program 11.0

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

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

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

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

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

    if -1.6142066513649255e-137 < (/ y z) < 1.9933305190113944e-307

    1. Initial program 16.8

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

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

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

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

      \[\leadsto x \cdot \color{blue}{\frac{y}{z}}\]
    7. Taylor expanded around inf 1.0

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

    if 9.807437992397751e+137 < (/ y z)

    1. Initial program 30.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.6142066513649255 \cdot 10^{-137}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 1.9933305190113944 \cdot 10^{-307}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 9.807437992397751 \cdot 10^{+137}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{z} \cdot y\\ \end{array}\]

Reproduce

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