Average Error: 14.5 → 1.7
Time: 12.8s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;\frac{y}{z} \le -4.693289067124317 \cdot 10^{-250}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\left(x \cdot \frac{1}{z}\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} = -\infty:\\
\;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\

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

\mathbf{elif}\;\frac{y}{z} \le -0.0:\\
\;\;\;\;\left(x \cdot \frac{1}{z}\right) \cdot y\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r13093638 = x;
        double r13093639 = y;
        double r13093640 = z;
        double r13093641 = r13093639 / r13093640;
        double r13093642 = t;
        double r13093643 = r13093641 * r13093642;
        double r13093644 = r13093643 / r13093642;
        double r13093645 = r13093638 * r13093644;
        return r13093645;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r13093646 = y;
        double r13093647 = z;
        double r13093648 = r13093646 / r13093647;
        double r13093649 = -inf.0;
        bool r13093650 = r13093648 <= r13093649;
        double r13093651 = 1.0;
        double r13093652 = r13093651 / r13093647;
        double r13093653 = x;
        double r13093654 = r13093653 * r13093646;
        double r13093655 = r13093652 * r13093654;
        double r13093656 = -4.693289067124317e-250;
        bool r13093657 = r13093648 <= r13093656;
        double r13093658 = r13093653 * r13093648;
        double r13093659 = -0.0;
        bool r13093660 = r13093648 <= r13093659;
        double r13093661 = r13093653 * r13093652;
        double r13093662 = r13093661 * r13093646;
        double r13093663 = r13093647 / r13093646;
        double r13093664 = r13093653 / r13093663;
        double r13093665 = r13093660 ? r13093662 : r13093664;
        double r13093666 = r13093657 ? r13093658 : r13093665;
        double r13093667 = r13093650 ? r13093655 : r13093666;
        return r13093667;
}

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 60.0

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    4. Using strategy rm
    5. Applied clear-num0.4

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    6. Using strategy rm
    7. Applied associate-/r/0.3

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

    if -inf.0 < (/ y z) < -4.693289067124317e-250

    1. Initial program 10.9

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

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

    if -4.693289067124317e-250 < (/ y z) < -0.0

    1. Initial program 19.2

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

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

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    4. Using strategy rm
    5. Applied clear-num0.9

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{x \cdot y}}}\]
    6. Using strategy rm
    7. Applied associate-/r/0.2

      \[\leadsto \color{blue}{\frac{1}{z} \cdot \left(x \cdot y\right)}\]
    8. Using strategy rm
    9. Applied associate-*r*0.2

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

    if -0.0 < (/ y z)

    1. Initial program 12.8

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} = -\infty:\\ \;\;\;\;\frac{1}{z} \cdot \left(x \cdot y\right)\\ \mathbf{elif}\;\frac{y}{z} \le -4.693289067124317 \cdot 10^{-250}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\left(x \cdot \frac{1}{z}\right) \cdot y\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \end{array}\]

Reproduce

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