Average Error: 14.7 → 1.8
Time: 4.2s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.55389167634140265 \cdot 10^{-149}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.4704572909860111 \cdot 10^{-239}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 7.35260291402330968 \cdot 10^{277}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -4.55389167634140265 \cdot 10^{-149}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

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

\mathbf{elif}\;\frac{y}{z} \le 7.35260291402330968 \cdot 10^{277}:\\
\;\;\;\;x \cdot \frac{y}{z}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r600482 = x;
        double r600483 = y;
        double r600484 = z;
        double r600485 = r600483 / r600484;
        double r600486 = t;
        double r600487 = r600485 * r600486;
        double r600488 = r600487 / r600486;
        double r600489 = r600482 * r600488;
        return r600489;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r600490 = y;
        double r600491 = z;
        double r600492 = r600490 / r600491;
        double r600493 = -4.553891676341403e-149;
        bool r600494 = r600492 <= r600493;
        double r600495 = x;
        double r600496 = r600491 / r600490;
        double r600497 = r600495 / r600496;
        double r600498 = 1.470457290986011e-239;
        bool r600499 = r600492 <= r600498;
        double r600500 = r600495 * r600490;
        double r600501 = r600500 / r600491;
        double r600502 = 7.35260291402331e+277;
        bool r600503 = r600492 <= r600502;
        double r600504 = r600495 * r600492;
        double r600505 = 1.0;
        double r600506 = r600491 / r600500;
        double r600507 = r600505 / r600506;
        double r600508 = r600503 ? r600504 : r600507;
        double r600509 = r600499 ? r600501 : r600508;
        double r600510 = r600494 ? r600497 : r600509;
        return r600510;
}

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

Target

Original14.7
Target1.6
Herbie1.8
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.20672205123045005 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390633 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.65895442315341522 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.0087180502407133 \cdot 10^{217}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{y \cdot x}{z}\\ \end{array}\]

Derivation

  1. Split input into 4 regimes
  2. if (/ y z) < -4.553891676341403e-149

    1. Initial program 13.5

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

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

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

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

    if -4.553891676341403e-149 < (/ y z) < 1.470457290986011e-239

    1. Initial program 17.2

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

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

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

    if 1.470457290986011e-239 < (/ y z) < 7.35260291402331e+277

    1. Initial program 9.8

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

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

    if 7.35260291402331e+277 < (/ y z)

    1. Initial program 55.4

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -4.55389167634140265 \cdot 10^{-149}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{elif}\;\frac{y}{z} \le 1.4704572909860111 \cdot 10^{-239}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le 7.35260291402330968 \cdot 10^{277}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< (/ (* (/ y z) t) t) -1.20672205123045e+245) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) -5.907522236933906e-275) (* x (/ y z)) (if (< (/ (* (/ y z) t) t) 5.658954423153415e-65) (/ y (/ z x)) (if (< (/ (* (/ y z) t) t) 2.0087180502407133e+217) (* x (/ y z)) (/ (* y x) z)))))

  (* x (/ (* (/ y z) t) t)))