Average Error: 15.3 → 0.6
Time: 15.1s
Precision: 64
\[x \cdot \frac{\frac{y}{z} \cdot t}{t}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\ \;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{elif}\;\frac{y}{z} \le -8.577400369799064208368387316979607426764 \cdot 10^{-204}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;\frac{y}{z} \le 1.9347234214895972433294907337595387054 \cdot 10^{240}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \end{array}\]
x \cdot \frac{\frac{y}{z} \cdot t}{t}
\begin{array}{l}
\mathbf{if}\;\frac{y}{z} \le -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\
\;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\

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

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

\mathbf{elif}\;\frac{y}{z} \le 1.9347234214895972433294907337595387054 \cdot 10^{240}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r31137626 = x;
        double r31137627 = y;
        double r31137628 = z;
        double r31137629 = r31137627 / r31137628;
        double r31137630 = t;
        double r31137631 = r31137629 * r31137630;
        double r31137632 = r31137631 / r31137630;
        double r31137633 = r31137626 * r31137632;
        return r31137633;
}

double f(double x, double y, double z, double __attribute__((unused)) t) {
        double r31137634 = y;
        double r31137635 = z;
        double r31137636 = r31137634 / r31137635;
        double r31137637 = -1.548240730790441e+219;
        bool r31137638 = r31137636 <= r31137637;
        double r31137639 = 1.0;
        double r31137640 = x;
        double r31137641 = r31137634 * r31137640;
        double r31137642 = r31137635 / r31137641;
        double r31137643 = r31137639 / r31137642;
        double r31137644 = -8.577400369799064e-204;
        bool r31137645 = r31137636 <= r31137644;
        double r31137646 = r31137640 * r31137636;
        double r31137647 = -0.0;
        bool r31137648 = r31137636 <= r31137647;
        double r31137649 = r31137639 / r31137635;
        double r31137650 = r31137649 * r31137641;
        double r31137651 = 1.9347234214895972e+240;
        bool r31137652 = r31137636 <= r31137651;
        double r31137653 = r31137635 / r31137634;
        double r31137654 = r31137640 / r31137653;
        double r31137655 = r31137652 ? r31137654 : r31137650;
        double r31137656 = r31137648 ? r31137650 : r31137655;
        double r31137657 = r31137645 ? r31137646 : r31137656;
        double r31137658 = r31137638 ? r31137643 : r31137657;
        return r31137658;
}

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.3
Target1.6
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;\frac{\frac{y}{z} \cdot t}{t} \lt -1.206722051230450047215521150762600712224 \cdot 10^{245}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt -5.90752223693390632993316700759382836344 \cdot 10^{-275}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 5.658954423153415216825328199697215652986 \cdot 10^{-65}:\\ \;\;\;\;\frac{y}{\frac{z}{x}}\\ \mathbf{elif}\;\frac{\frac{y}{z} \cdot t}{t} \lt 2.008718050240713347941382056648619307142 \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) < -1.548240730790441e+219

    1. Initial program 44.8

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

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

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

    if -1.548240730790441e+219 < (/ y z) < -8.577400369799064e-204

    1. Initial program 9.2

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

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

      \[\leadsto \frac{x \cdot y}{\color{blue}{1 \cdot z}}\]
    5. Applied times-frac0.2

      \[\leadsto \color{blue}{\frac{x}{1} \cdot \frac{y}{z}}\]
    6. Simplified0.2

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

    if -8.577400369799064e-204 < (/ y z) < -0.0 or 1.9347234214895972e+240 < (/ y z)

    1. Initial program 23.4

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

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

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

    if -0.0 < (/ y z) < 1.9347234214895972e+240

    1. Initial program 10.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y}{z} \le -1.548240730790440881436662006949490760264 \cdot 10^{219}:\\ \;\;\;\;\frac{1}{\frac{z}{y \cdot x}}\\ \mathbf{elif}\;\frac{y}{z} \le -8.577400369799064208368387316979607426764 \cdot 10^{-204}:\\ \;\;\;\;x \cdot \frac{y}{z}\\ \mathbf{elif}\;\frac{y}{z} \le -0.0:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \mathbf{elif}\;\frac{y}{z} \le 1.9347234214895972433294907337595387054 \cdot 10^{240}:\\ \;\;\;\;\frac{x}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{z} \cdot \left(y \cdot x\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x y z t)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, B"

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