Average Error: 6.9 → 1.9
Time: 47.8s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le 1.4262265949406686 \cdot 10^{-28}:\\ \;\;\;\;\left(x + \frac{z}{\frac{t}{y}}\right) - \frac{x}{\frac{t}{y}}\\ \mathbf{elif}\;y \le 1.5702655586275871 \cdot 10^{+199}:\\ \;\;\;\;y \cdot \frac{z - x}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \le 1.4262265949406686 \cdot 10^{-28}:\\
\;\;\;\;\left(x + \frac{z}{\frac{t}{y}}\right) - \frac{x}{\frac{t}{y}}\\

\mathbf{elif}\;y \le 1.5702655586275871 \cdot 10^{+199}:\\
\;\;\;\;y \cdot \frac{z - x}{t} + x\\

\mathbf{else}:\\
\;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\

\end{array}
double f(double x, double y, double z, double t) {
        double r16621858 = x;
        double r16621859 = y;
        double r16621860 = z;
        double r16621861 = r16621860 - r16621858;
        double r16621862 = r16621859 * r16621861;
        double r16621863 = t;
        double r16621864 = r16621862 / r16621863;
        double r16621865 = r16621858 + r16621864;
        return r16621865;
}

double f(double x, double y, double z, double t) {
        double r16621866 = y;
        double r16621867 = 1.4262265949406686e-28;
        bool r16621868 = r16621866 <= r16621867;
        double r16621869 = x;
        double r16621870 = z;
        double r16621871 = t;
        double r16621872 = r16621871 / r16621866;
        double r16621873 = r16621870 / r16621872;
        double r16621874 = r16621869 + r16621873;
        double r16621875 = r16621869 / r16621872;
        double r16621876 = r16621874 - r16621875;
        double r16621877 = 1.5702655586275871e+199;
        bool r16621878 = r16621866 <= r16621877;
        double r16621879 = r16621870 - r16621869;
        double r16621880 = r16621879 / r16621871;
        double r16621881 = r16621866 * r16621880;
        double r16621882 = r16621881 + r16621869;
        double r16621883 = r16621866 / r16621871;
        double r16621884 = r16621883 * r16621879;
        double r16621885 = r16621884 + r16621869;
        double r16621886 = r16621878 ? r16621882 : r16621885;
        double r16621887 = r16621868 ? r16621876 : r16621886;
        return r16621887;
}

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.9
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 y < 1.4262265949406686e-28

    1. Initial program 4.6

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

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

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

      \[\leadsto x + \color{blue}{\left(\frac{z}{\frac{t}{y}} - \frac{x}{\frac{t}{y}}\right)}\]
    6. Applied associate-+r-1.8

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

    if 1.4262265949406686e-28 < y < 1.5702655586275871e+199

    1. Initial program 9.9

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

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

      \[\leadsto x + \color{blue}{\frac{z - x}{\frac{t}{y}}}\]
    4. Using strategy rm
    5. Applied associate-/r/0.9

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

    if 1.5702655586275871e+199 < y

    1. Initial program 30.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le 1.4262265949406686 \cdot 10^{-28}:\\ \;\;\;\;\left(x + \frac{z}{\frac{t}{y}}\right) - \frac{x}{\frac{t}{y}}\\ \mathbf{elif}\;y \le 1.5702655586275871 \cdot 10^{+199}:\\ \;\;\;\;y \cdot \frac{z - x}{t} + x\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{t} \cdot \left(z - x\right) + x\\ \end{array}\]

Reproduce

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