Average Error: 6.5 → 1.5
Time: 13.7s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.61770217190675352 \cdot 10^{36} \lor \neg \left(t \le 2.9560956140306957 \cdot 10^{26}\right):\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot y}{t}\right)\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.61770217190675352 \cdot 10^{36} \lor \neg \left(t \le 2.9560956140306957 \cdot 10^{26}\right):\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r379658 = x;
        double r379659 = y;
        double r379660 = z;
        double r379661 = r379660 - r379658;
        double r379662 = r379659 * r379661;
        double r379663 = t;
        double r379664 = r379662 / r379663;
        double r379665 = r379658 + r379664;
        return r379665;
}

double f(double x, double y, double z, double t) {
        double r379666 = t;
        double r379667 = -1.6177021719067535e+36;
        bool r379668 = r379666 <= r379667;
        double r379669 = 2.9560956140306957e+26;
        bool r379670 = r379666 <= r379669;
        double r379671 = !r379670;
        bool r379672 = r379668 || r379671;
        double r379673 = x;
        double r379674 = z;
        double r379675 = r379674 - r379673;
        double r379676 = y;
        double r379677 = r379666 / r379676;
        double r379678 = r379675 / r379677;
        double r379679 = r379673 + r379678;
        double r379680 = r379674 * r379676;
        double r379681 = r379680 / r379666;
        double r379682 = r379673 * r379676;
        double r379683 = r379682 / r379666;
        double r379684 = r379681 - r379683;
        double r379685 = r379673 + r379684;
        double r379686 = r379672 ? r379679 : r379685;
        return r379686;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -1.6177021719067535e+36 or 2.9560956140306957e+26 < t

    1. Initial program 10.2

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

      \[\leadsto x + \color{blue}{1 \cdot \frac{y \cdot \left(z - x\right)}{t}}\]
    4. Applied *-un-lft-identity10.2

      \[\leadsto \color{blue}{1 \cdot x} + 1 \cdot \frac{y \cdot \left(z - x\right)}{t}\]
    5. Applied distribute-lft-out10.2

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

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

    if -1.6177021719067535e+36 < t < 2.9560956140306957e+26

    1. Initial program 1.8

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.61770217190675352 \cdot 10^{36} \lor \neg \left(t \le 2.9560956140306957 \cdot 10^{26}\right):\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{t} - \frac{x \cdot y}{t}\right)\\ \end{array}\]

Reproduce

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