Average Error: 6.5 → 1.9
Time: 13.5s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.642592177827107676405494020606785260044 \cdot 10^{-268}:\\ \;\;\;\;x - \frac{y}{t} \cdot \left(x - z\right)\\ \mathbf{elif}\;x \le 4.817264783557647095538793580222919409807 \cdot 10^{-197}:\\ \;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x - z}{\frac{t}{y}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \le -2.642592177827107676405494020606785260044 \cdot 10^{-268}:\\
\;\;\;\;x - \frac{y}{t} \cdot \left(x - z\right)\\

\mathbf{elif}\;x \le 4.817264783557647095538793580222919409807 \cdot 10^{-197}:\\
\;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r256928 = x;
        double r256929 = y;
        double r256930 = z;
        double r256931 = r256930 - r256928;
        double r256932 = r256929 * r256931;
        double r256933 = t;
        double r256934 = r256932 / r256933;
        double r256935 = r256928 + r256934;
        return r256935;
}

double f(double x, double y, double z, double t) {
        double r256936 = x;
        double r256937 = -2.6425921778271077e-268;
        bool r256938 = r256936 <= r256937;
        double r256939 = y;
        double r256940 = t;
        double r256941 = r256939 / r256940;
        double r256942 = z;
        double r256943 = r256936 - r256942;
        double r256944 = r256941 * r256943;
        double r256945 = r256936 - r256944;
        double r256946 = 4.817264783557647e-197;
        bool r256947 = r256936 <= r256946;
        double r256948 = r256940 / r256943;
        double r256949 = r256939 / r256948;
        double r256950 = r256936 - r256949;
        double r256951 = r256940 / r256939;
        double r256952 = r256943 / r256951;
        double r256953 = r256936 - r256952;
        double r256954 = r256947 ? r256950 : r256953;
        double r256955 = r256938 ? r256945 : r256954;
        return r256955;
}

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.5
Target2.1
Herbie1.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 < -2.6425921778271077e-268

    1. Initial program 6.8

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

      \[\leadsto \color{blue}{x - \frac{y \cdot \left(x - z\right)}{t}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity6.8

      \[\leadsto x - \color{blue}{1 \cdot \frac{y \cdot \left(x - z\right)}{t}}\]
    5. Applied *-un-lft-identity6.8

      \[\leadsto \color{blue}{1 \cdot x} - 1 \cdot \frac{y \cdot \left(x - z\right)}{t}\]
    6. Applied distribute-lft-out--6.8

      \[\leadsto \color{blue}{1 \cdot \left(x - \frac{y \cdot \left(x - z\right)}{t}\right)}\]
    7. Simplified1.7

      \[\leadsto 1 \cdot \color{blue}{\left(x - \frac{x - z}{\frac{t}{y}}\right)}\]
    8. Using strategy rm
    9. Applied div-inv1.9

      \[\leadsto 1 \cdot \left(x - \color{blue}{\left(x - z\right) \cdot \frac{1}{\frac{t}{y}}}\right)\]
    10. Simplified1.8

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

    if -2.6425921778271077e-268 < x < 4.817264783557647e-197

    1. Initial program 5.2

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

      \[\leadsto \color{blue}{x - \frac{y \cdot \left(x - z\right)}{t}}\]
    3. Using strategy rm
    4. Applied associate-/l*5.0

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

    if 4.817264783557647e-197 < x

    1. Initial program 6.7

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

      \[\leadsto \color{blue}{x - \frac{y \cdot \left(x - z\right)}{t}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity6.7

      \[\leadsto x - \color{blue}{1 \cdot \frac{y \cdot \left(x - z\right)}{t}}\]
    5. Applied *-un-lft-identity6.7

      \[\leadsto \color{blue}{1 \cdot x} - 1 \cdot \frac{y \cdot \left(x - z\right)}{t}\]
    6. Applied distribute-lft-out--6.7

      \[\leadsto \color{blue}{1 \cdot \left(x - \frac{y \cdot \left(x - z\right)}{t}\right)}\]
    7. Simplified1.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.642592177827107676405494020606785260044 \cdot 10^{-268}:\\ \;\;\;\;x - \frac{y}{t} \cdot \left(x - z\right)\\ \mathbf{elif}\;x \le 4.817264783557647095538793580222919409807 \cdot 10^{-197}:\\ \;\;\;\;x - \frac{y}{\frac{t}{x - z}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{x - z}{\frac{t}{y}}\\ \end{array}\]

Reproduce

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