Average Error: 6.3 → 1.7
Time: 19.9s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{elif}\;t \le 1.1571448244703465 \cdot 10^{-56}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r243125 = x;
        double r243126 = y;
        double r243127 = z;
        double r243128 = r243127 - r243125;
        double r243129 = r243126 * r243128;
        double r243130 = t;
        double r243131 = r243129 / r243130;
        double r243132 = r243125 + r243131;
        return r243132;
}

double f(double x, double y, double z, double t) {
        double r243133 = t;
        double r243134 = -1.28204979550362e+41;
        bool r243135 = r243133 <= r243134;
        double r243136 = x;
        double r243137 = z;
        double r243138 = r243137 - r243136;
        double r243139 = y;
        double r243140 = r243133 / r243139;
        double r243141 = r243138 / r243140;
        double r243142 = r243136 + r243141;
        double r243143 = 1.1571448244703465e-56;
        bool r243144 = r243133 <= r243143;
        double r243145 = r243139 * r243138;
        double r243146 = 1.0;
        double r243147 = r243146 / r243133;
        double r243148 = r243145 * r243147;
        double r243149 = r243136 + r243148;
        double r243150 = r243133 / r243138;
        double r243151 = r243139 / r243150;
        double r243152 = r243136 + r243151;
        double r243153 = r243144 ? r243149 : r243152;
        double r243154 = r243135 ? r243142 : r243153;
        return r243154;
}

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

Derivation

  1. Split input into 3 regimes
  2. if t < -1.28204979550362e+41

    1. Initial program 10.8

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

      \[\leadsto x + \color{blue}{\left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}}\]
    4. Taylor expanded around 0 10.8

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

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

    if -1.28204979550362e+41 < t < 1.1571448244703465e-56

    1. Initial program 2.1

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

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

    if 1.1571448244703465e-56 < t

    1. Initial program 7.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.2820497955036201 \cdot 10^{41}:\\ \;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\ \mathbf{elif}\;t \le 1.1571448244703465 \cdot 10^{-56}:\\ \;\;\;\;x + \left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{t}{z - x}}\\ \end{array}\]

Reproduce

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