Average Error: 15.4 → 1.0
Time: 14.6s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\ \;\;\;\;\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}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\

\mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\
\;\;\;\;\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 r804280 = x;
        double r804281 = y;
        double r804282 = z;
        double r804283 = r804281 / r804282;
        double r804284 = t;
        double r804285 = r804283 * r804284;
        double r804286 = r804285 / r804284;
        double r804287 = r804280 * r804286;
        return r804287;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r804288 = y;
        double r804289 = z;
        double r804290 = r804288 / r804289;
        double r804291 = -1.057433920064963e+133;
        bool r804292 = r804290 <= r804291;
        double r804293 = 1.0;
        double r804294 = x;
        double r804295 = r804294 * r804288;
        double r804296 = r804289 / r804295;
        double r804297 = r804293 / r804296;
        double r804298 = -1.0665637347194774e-221;
        bool r804299 = r804290 <= r804298;
        double r804300 = 1.5828563463705101e-127;
        bool r804301 = r804290 <= r804300;
        double r804302 = !r804301;
        double r804303 = 2.5905951762285947e+176;
        bool r804304 = r804290 <= r804303;
        bool r804305 = r804302 && r804304;
        bool r804306 = r804299 || r804305;
        double r804307 = r804289 / r804288;
        double r804308 = r804294 / r804307;
        double r804309 = r804295 / r804289;
        double r804310 = r804306 ? r804308 : r804309;
        double r804311 = r804292 ? r804297 : r804310;
        return r804311;
}

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

Original15.4
Target1.5
Herbie1.0
\[\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 3 regimes
  2. if (/ y z) < -1.057433920064963e+133

    1. Initial program 34.0

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity16.5

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

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

      \[\leadsto 1 \cdot \color{blue}{\frac{x \cdot y}{z}}\]
    7. Using strategy rm
    8. Applied clear-num4.1

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

    if -1.057433920064963e+133 < (/ y z) < -1.0665637347194774e-221 or 1.5828563463705101e-127 < (/ y z) < 2.5905951762285947e+176

    1. Initial program 6.8

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity0.2

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

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

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

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

    if -1.0665637347194774e-221 < (/ y z) < 1.5828563463705101e-127 or 2.5905951762285947e+176 < (/ y z)

    1. Initial program 22.0

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

      \[\leadsto \color{blue}{x \cdot \frac{y}{z}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity12.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.057433920064963 \cdot 10^{133}:\\ \;\;\;\;\frac{1}{\frac{z}{x \cdot y}}\\ \mathbf{elif}\;\frac{y}{z} \le -1.0665637347194774 \cdot 10^{-221} \lor \neg \left(\frac{y}{z} \le 1.5828563463705101 \cdot 10^{-127}\right) \land \frac{y}{z} \le 2.5905951762285947 \cdot 10^{176}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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