Average Error: 15.4 → 1.0
Time: 13.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 r697156 = x;
        double r697157 = y;
        double r697158 = z;
        double r697159 = r697157 / r697158;
        double r697160 = t;
        double r697161 = r697159 * r697160;
        double r697162 = r697161 / r697160;
        double r697163 = r697156 * r697162;
        return r697163;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r697164 = y;
        double r697165 = z;
        double r697166 = r697164 / r697165;
        double r697167 = -1.057433920064963e+133;
        bool r697168 = r697166 <= r697167;
        double r697169 = 1.0;
        double r697170 = x;
        double r697171 = r697170 * r697164;
        double r697172 = r697165 / r697171;
        double r697173 = r697169 / r697172;
        double r697174 = -1.0665637347194774e-221;
        bool r697175 = r697166 <= r697174;
        double r697176 = 1.5828563463705101e-127;
        bool r697177 = r697166 <= r697176;
        double r697178 = !r697177;
        double r697179 = 2.5905951762285947e+176;
        bool r697180 = r697166 <= r697179;
        bool r697181 = r697178 && r697180;
        bool r697182 = r697175 || r697181;
        double r697183 = r697165 / r697164;
        double r697184 = r697170 / r697183;
        double r697185 = r697171 / r697165;
        double r697186 = r697182 ? r697184 : r697185;
        double r697187 = r697168 ? r697173 : r697186;
        return r697187;
}

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 
(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)))