Average Error: 6.0 → 0.9
Time: 12.4s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty:\\ \;\;\;\;x + \frac{1}{\frac{\frac{t}{z - x}}{y}}\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 3.099554537632007480200658906263938053889 \cdot 10^{297}:\\ \;\;\;\;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}\;x + \frac{y \cdot \left(z - x\right)}{t} = -\infty:\\
\;\;\;\;x + \frac{1}{\frac{\frac{t}{z - x}}{y}}\\

\mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 3.099554537632007480200658906263938053889 \cdot 10^{297}:\\
\;\;\;\;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 r220876 = x;
        double r220877 = y;
        double r220878 = z;
        double r220879 = r220878 - r220876;
        double r220880 = r220877 * r220879;
        double r220881 = t;
        double r220882 = r220880 / r220881;
        double r220883 = r220876 + r220882;
        return r220883;
}

double f(double x, double y, double z, double t) {
        double r220884 = x;
        double r220885 = y;
        double r220886 = z;
        double r220887 = r220886 - r220884;
        double r220888 = r220885 * r220887;
        double r220889 = t;
        double r220890 = r220888 / r220889;
        double r220891 = r220884 + r220890;
        double r220892 = -inf.0;
        bool r220893 = r220891 <= r220892;
        double r220894 = 1.0;
        double r220895 = r220889 / r220887;
        double r220896 = r220895 / r220885;
        double r220897 = r220894 / r220896;
        double r220898 = r220884 + r220897;
        double r220899 = 3.0995545376320075e+297;
        bool r220900 = r220891 <= r220899;
        double r220901 = r220887 / r220889;
        double r220902 = r220885 * r220901;
        double r220903 = r220884 + r220902;
        double r220904 = r220900 ? r220891 : r220903;
        double r220905 = r220893 ? r220898 : r220904;
        return r220905;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (+ x (/ (* y (- z x)) t)) < -inf.0

    1. Initial program 64.0

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{t}{z - x}}}\]
    4. Using strategy rm
    5. Applied clear-num0.3

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

    if -inf.0 < (+ x (/ (* y (- z x)) t)) < 3.0995545376320075e+297

    1. Initial program 0.7

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

    if 3.0995545376320075e+297 < (+ x (/ (* y (- z x)) t))

    1. Initial program 52.9

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

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

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

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

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

Reproduce

herbie shell --seed 2019212 
(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)))