Average Error: 14.6 → 5.7
Time: 10.9s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.926373121714999364733704764752531243436 \cdot 10^{-253}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;t \le 602927915546591127029321564160:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;t \le -9.926373121714999364733704764752531243436 \cdot 10^{-253}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\

\mathbf{elif}\;t \le 602927915546591127029321564160:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r62471 = x;
        double r62472 = y;
        double r62473 = z;
        double r62474 = r62472 / r62473;
        double r62475 = t;
        double r62476 = r62474 * r62475;
        double r62477 = r62476 / r62475;
        double r62478 = r62471 * r62477;
        return r62478;
}

double f(double x, double y, double z, double t) {
        double r62479 = t;
        double r62480 = -9.926373121714999e-253;
        bool r62481 = r62479 <= r62480;
        double r62482 = y;
        double r62483 = z;
        double r62484 = x;
        double r62485 = r62483 / r62484;
        double r62486 = r62482 / r62485;
        double r62487 = 6.029279155465911e+29;
        bool r62488 = r62479 <= r62487;
        double r62489 = r62483 / r62482;
        double r62490 = r62484 / r62489;
        double r62491 = r62484 * r62482;
        double r62492 = r62491 / r62483;
        double r62493 = r62488 ? r62490 : r62492;
        double r62494 = r62481 ? r62486 : r62493;
        return r62494;
}

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 t < -9.926373121714999e-253

    1. Initial program 13.5

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

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

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

    if -9.926373121714999e-253 < t < 6.029279155465911e+29

    1. Initial program 15.6

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

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

      \[\leadsto \color{blue}{\left(y \cdot x\right) \cdot \frac{1}{z}}\]
    5. Taylor expanded around 0 6.0

      \[\leadsto \color{blue}{\frac{x \cdot y}{z}}\]
    6. Simplified5.8

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

    if 6.029279155465911e+29 < t

    1. Initial program 15.4

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.926373121714999364733704764752531243436 \cdot 10^{-253}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;t \le 602927915546591127029321564160:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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