Average Error: 6.5 → 3.7
Time: 13.1s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.330085788570188 \cdot 10^{-304}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{z}{\frac{t}{y}}\right) - x \cdot \frac{1}{\frac{t}{y}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x \le -7.330085788570188 \cdot 10^{-304}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r11047517 = x;
        double r11047518 = y;
        double r11047519 = z;
        double r11047520 = r11047519 - r11047517;
        double r11047521 = r11047518 * r11047520;
        double r11047522 = t;
        double r11047523 = r11047521 / r11047522;
        double r11047524 = r11047517 + r11047523;
        return r11047524;
}

double f(double x, double y, double z, double t) {
        double r11047525 = x;
        double r11047526 = -7.330085788570188e-304;
        bool r11047527 = r11047525 <= r11047526;
        double r11047528 = y;
        double r11047529 = t;
        double r11047530 = z;
        double r11047531 = r11047530 - r11047525;
        double r11047532 = r11047529 / r11047531;
        double r11047533 = r11047528 / r11047532;
        double r11047534 = r11047525 + r11047533;
        double r11047535 = r11047529 / r11047528;
        double r11047536 = r11047530 / r11047535;
        double r11047537 = r11047525 + r11047536;
        double r11047538 = 1.0;
        double r11047539 = r11047538 / r11047535;
        double r11047540 = r11047525 * r11047539;
        double r11047541 = r11047537 - r11047540;
        double r11047542 = r11047527 ? r11047534 : r11047541;
        return r11047542;
}

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
Herbie3.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 x < -7.330085788570188e-304

    1. Initial program 6.7

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

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

    if -7.330085788570188e-304 < x

    1. Initial program 6.4

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

      \[\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 div-sub2.0

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.330085788570188 \cdot 10^{-304}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;\left(x + \frac{z}{\frac{t}{y}}\right) - x \cdot \frac{1}{\frac{t}{y}}\\ \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)))