Average Error: 6.4 → 1.7
Time: 7.5s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.310708342905894128058674458977299359418 \cdot 10^{-39}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;y \le -2.310708342905894128058674458977299359418 \cdot 10^{-39}:\\
\;\;\;\;x + y \cdot \frac{z - x}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r313835 = x;
        double r313836 = y;
        double r313837 = z;
        double r313838 = r313837 - r313835;
        double r313839 = r313836 * r313838;
        double r313840 = t;
        double r313841 = r313839 / r313840;
        double r313842 = r313835 + r313841;
        return r313842;
}

double f(double x, double y, double z, double t) {
        double r313843 = y;
        double r313844 = -2.310708342905894e-39;
        bool r313845 = r313843 <= r313844;
        double r313846 = x;
        double r313847 = z;
        double r313848 = r313847 - r313846;
        double r313849 = t;
        double r313850 = r313848 / r313849;
        double r313851 = r313843 * r313850;
        double r313852 = r313846 + r313851;
        double r313853 = r313843 / r313849;
        double r313854 = 1.0;
        double r313855 = r313854 / r313848;
        double r313856 = r313853 / r313855;
        double r313857 = r313846 + r313856;
        double r313858 = r313845 ? r313852 : r313857;
        return r313858;
}

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.4
Target2.0
Herbie1.7
\[x - \left(x \cdot \frac{y}{t} + \left(-z\right) \cdot \frac{y}{t}\right)\]

Derivation

  1. Split input into 2 regimes
  2. if y < -2.310708342905894e-39

    1. Initial program 13.9

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

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

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

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

    if -2.310708342905894e-39 < y

    1. Initial program 4.3

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

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

      \[\leadsto x + \frac{y}{\color{blue}{t \cdot \frac{1}{z - x}}}\]
    6. Applied associate-/r*1.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.310708342905894128058674458977299359418 \cdot 10^{-39}:\\ \;\;\;\;x + y \cdot \frac{z - x}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \end{array}\]

Reproduce

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