Average Error: 6.2 → 1.9
Time: 16.9s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 6.48136672668775 \cdot 10^{+270}:\\ \;\;\;\;x + \frac{\left(z - x\right) \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z - x}{t} \cdot y + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r18626021 = x;
        double r18626022 = y;
        double r18626023 = z;
        double r18626024 = r18626023 - r18626021;
        double r18626025 = r18626022 * r18626024;
        double r18626026 = t;
        double r18626027 = r18626025 / r18626026;
        double r18626028 = r18626021 + r18626027;
        return r18626028;
}

double f(double x, double y, double z, double t) {
        double r18626029 = x;
        double r18626030 = z;
        double r18626031 = r18626030 - r18626029;
        double r18626032 = y;
        double r18626033 = r18626031 * r18626032;
        double r18626034 = t;
        double r18626035 = r18626033 / r18626034;
        double r18626036 = r18626029 + r18626035;
        double r18626037 = 3.839280362027844e-155;
        bool r18626038 = r18626036 <= r18626037;
        double r18626039 = r18626032 / r18626034;
        double r18626040 = r18626039 * r18626031;
        double r18626041 = r18626029 + r18626040;
        double r18626042 = 6.48136672668775e+270;
        bool r18626043 = r18626036 <= r18626042;
        double r18626044 = r18626031 / r18626034;
        double r18626045 = r18626044 * r18626032;
        double r18626046 = r18626045 + r18626029;
        double r18626047 = r18626043 ? r18626036 : r18626046;
        double r18626048 = r18626038 ? r18626041 : r18626047;
        return r18626048;
}

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.2
Target2.0
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 (/ (* y (- z x)) t)) < 3.839280362027844e-155

    1. Initial program 6.1

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

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

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

    if 3.839280362027844e-155 < (+ x (/ (* y (- z x)) t)) < 6.48136672668775e+270

    1. Initial program 0.3

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

    if 6.48136672668775e+270 < (+ x (/ (* y (- z x)) t))

    1. Initial program 34.7

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 3.839280362027844 \cdot 10^{-155}:\\ \;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\ \mathbf{elif}\;x + \frac{\left(z - x\right) \cdot y}{t} \le 6.48136672668775 \cdot 10^{+270}:\\ \;\;\;\;x + \frac{\left(z - x\right) \cdot y}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{z - x}{t} \cdot y + x\\ \end{array}\]

Reproduce

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