Average Error: 14.3 → 2.2
Time: 11.3s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.0532464204699888 \cdot 10^{+209}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -6.588547053565423 \cdot 10^{-193}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.2740014914314757 \cdot 10^{-89}:\\ \;\;\;\;\frac{x \cdot y}{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} \le -1.0532464204699888 \cdot 10^{+209}:\\
\;\;\;\;y \cdot \frac{x}{z}\\

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r1544782 = x;
        double r1544783 = y;
        double r1544784 = z;
        double r1544785 = r1544783 / r1544784;
        double r1544786 = t;
        double r1544787 = r1544785 * r1544786;
        double r1544788 = r1544787 / r1544786;
        double r1544789 = r1544782 * r1544788;
        return r1544789;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r1544790 = y;
        double r1544791 = z;
        double r1544792 = r1544790 / r1544791;
        double r1544793 = -1.0532464204699888e+209;
        bool r1544794 = r1544792 <= r1544793;
        double r1544795 = x;
        double r1544796 = r1544795 / r1544791;
        double r1544797 = r1544790 * r1544796;
        double r1544798 = -6.588547053565423e-193;
        bool r1544799 = r1544792 <= r1544798;
        double r1544800 = r1544792 * r1544795;
        double r1544801 = 2.2740014914314757e-89;
        bool r1544802 = r1544792 <= r1544801;
        double r1544803 = r1544795 * r1544790;
        double r1544804 = r1544803 / r1544791;
        double r1544805 = r1544802 ? r1544804 : r1544800;
        double r1544806 = r1544799 ? r1544800 : r1544805;
        double r1544807 = r1544794 ? r1544797 : r1544806;
        return r1544807;
}

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.0532464204699888e+209

    1. Initial program 40.4

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

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

    if -1.0532464204699888e+209 < (/ y z) < -6.588547053565423e-193 or 2.2740014914314757e-89 < (/ y z)

    1. Initial program 11.1

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}}\]
    7. Using strategy rm
    8. Applied associate-/r/2.8

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

    if -6.588547053565423e-193 < (/ y z) < 2.2740014914314757e-89

    1. Initial program 15.7

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

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

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

      \[\leadsto \color{blue}{\frac{y}{\frac{z}{x}}}\]
    7. Using strategy rm
    8. Applied associate-/r/8.1

      \[\leadsto \color{blue}{\frac{y}{z} \cdot x}\]
    9. Taylor expanded around 0 1.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.0532464204699888 \cdot 10^{+209}:\\ \;\;\;\;y \cdot \frac{x}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -6.588547053565423 \cdot 10^{-193}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \mathbf{elif}\;\frac{y}{z} \le 2.2740014914314757 \cdot 10^{-89}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{z} \cdot x\\ \end{array}\]

Reproduce

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