Average Error: 6.6 → 2.3
Time: 3.1s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -5.79804013076068389 \cdot 10^{36}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;y \le 1.0561959963379154 \cdot 10^{-168}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \le -5.79804013076068389 \cdot 10^{36}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

\mathbf{elif}\;y \le 1.0561959963379154 \cdot 10^{-168}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r346889 = x;
        double r346890 = y;
        double r346891 = z;
        double r346892 = r346891 - r346889;
        double r346893 = r346890 * r346892;
        double r346894 = t;
        double r346895 = r346893 / r346894;
        double r346896 = r346889 + r346895;
        return r346896;
}

double f(double x, double y, double z, double t) {
        double r346897 = y;
        double r346898 = -5.798040130760684e+36;
        bool r346899 = r346897 <= r346898;
        double r346900 = x;
        double r346901 = t;
        double r346902 = z;
        double r346903 = r346902 - r346900;
        double r346904 = r346901 / r346903;
        double r346905 = r346897 / r346904;
        double r346906 = r346900 + r346905;
        double r346907 = 1.0561959963379154e-168;
        bool r346908 = r346897 <= r346907;
        double r346909 = r346897 * r346903;
        double r346910 = r346909 / r346901;
        double r346911 = r346900 + r346910;
        double r346912 = r346903 / r346901;
        double r346913 = r346897 * r346912;
        double r346914 = r346900 + r346913;
        double r346915 = r346908 ? r346911 : r346914;
        double r346916 = r346899 ? r346906 : r346915;
        return r346916;
}

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

Original6.6
Target2.1
Herbie2.3
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 3 regimes
  2. if y < -5.798040130760684e+36

    1. Initial program 17.6

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied associate-/l*2.1

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

    if -5.798040130760684e+36 < y < 1.0561959963379154e-168

    1. Initial program 1.3

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]

    if 1.0561959963379154e-168 < y

    1. Initial program 8.7

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity8.7

      \[\leadsto x + \frac{y \cdot \left(z - x\right)}{\color{blue}{1 \cdot t}}\]
    4. Applied times-frac3.9

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - x}{t}}\]
    5. Simplified3.9

      \[\leadsto x + \color{blue}{y} \cdot \frac{z - x}{t}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification2.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -5.79804013076068389 \cdot 10^{36}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{elif}\;y \le 1.0561959963379154 \cdot 10^{-168}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(FPCore (x y z t)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
  :precision binary64

  :herbie-target
  (- x (+ (* x (/ y t)) (* (- z) (/ y t))))

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