Average Error: 6.7 → 2.1
Time: 19.8s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -4.522558598098730171807553460225985750003 \cdot 10^{-68}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{elif}\;x \le 1.093916620246964999245952497324655985986 \cdot 10^{-234}:\\ \;\;\;\;\left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \le -4.522558598098730171807553460225985750003 \cdot 10^{-68}:\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r18130606 = x;
        double r18130607 = y;
        double r18130608 = z;
        double r18130609 = r18130608 - r18130606;
        double r18130610 = r18130607 * r18130609;
        double r18130611 = t;
        double r18130612 = r18130610 / r18130611;
        double r18130613 = r18130606 + r18130612;
        return r18130613;
}

double f(double x, double y, double z, double t) {
        double r18130614 = x;
        double r18130615 = -4.52255859809873e-68;
        bool r18130616 = r18130614 <= r18130615;
        double r18130617 = z;
        double r18130618 = r18130617 - r18130614;
        double r18130619 = t;
        double r18130620 = y;
        double r18130621 = r18130619 / r18130620;
        double r18130622 = r18130618 / r18130621;
        double r18130623 = r18130614 + r18130622;
        double r18130624 = 1.093916620246965e-234;
        bool r18130625 = r18130614 <= r18130624;
        double r18130626 = r18130620 * r18130618;
        double r18130627 = 1.0;
        double r18130628 = r18130627 / r18130619;
        double r18130629 = r18130626 * r18130628;
        double r18130630 = r18130629 + r18130614;
        double r18130631 = r18130625 ? r18130630 : r18130623;
        double r18130632 = r18130616 ? r18130623 : r18130631;
        return r18130632;
}

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.7
Target1.9
Herbie2.1
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if x < -4.52255859809873e-68 or 1.093916620246965e-234 < x

    1. Initial program 7.1

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Taylor expanded around 0 7.1

      \[\leadsto x + \color{blue}{\left(\frac{z \cdot y}{t} - \frac{x \cdot y}{t}\right)}\]
    3. Simplified0.9

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

    if -4.52255859809873e-68 < x < 1.093916620246965e-234

    1. Initial program 5.5

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Taylor expanded around 0 5.5

      \[\leadsto x + \color{blue}{\left(\frac{z \cdot y}{t} - \frac{x \cdot y}{t}\right)}\]
    3. Simplified4.5

      \[\leadsto x + \color{blue}{\frac{z - x}{\frac{t}{y}}}\]
    4. Using strategy rm
    5. Applied div-inv4.8

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

      \[\leadsto x + \left(z - x\right) \cdot \color{blue}{\frac{y}{t}}\]
    7. Using strategy rm
    8. Applied div-inv4.6

      \[\leadsto x + \left(z - x\right) \cdot \color{blue}{\left(y \cdot \frac{1}{t}\right)}\]
    9. Applied associate-*r*5.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -4.522558598098730171807553460225985750003 \cdot 10^{-68}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{elif}\;x \le 1.093916620246964999245952497324655985986 \cdot 10^{-234}:\\ \;\;\;\;\left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t} + x\\ \mathbf{else}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \end{array}\]

Reproduce

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

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

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