Average Error: 6.2 → 1.9
Time: 3.1s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;t \le -7.07003647724086002 \cdot 10^{-303} \lor \neg \left(t \le 1.2056496387991007 \cdot 10^{-37}\right):\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \cdot \left(z - x\right)}}\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \le -7.07003647724086002 \cdot 10^{-303} \lor \neg \left(t \le 1.2056496387991007 \cdot 10^{-37}\right):\\
\;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r847662 = x;
        double r847663 = y;
        double r847664 = z;
        double r847665 = r847664 - r847662;
        double r847666 = r847663 * r847665;
        double r847667 = t;
        double r847668 = r847666 / r847667;
        double r847669 = r847662 + r847668;
        return r847669;
}

double f(double x, double y, double z, double t) {
        double r847670 = t;
        double r847671 = -7.07003647724086e-303;
        bool r847672 = r847670 <= r847671;
        double r847673 = 1.2056496387991007e-37;
        bool r847674 = r847670 <= r847673;
        double r847675 = !r847674;
        bool r847676 = r847672 || r847675;
        double r847677 = x;
        double r847678 = y;
        double r847679 = r847678 / r847670;
        double r847680 = 1.0;
        double r847681 = z;
        double r847682 = r847681 - r847677;
        double r847683 = r847680 / r847682;
        double r847684 = r847679 / r847683;
        double r847685 = r847677 + r847684;
        double r847686 = r847678 * r847682;
        double r847687 = r847670 / r847686;
        double r847688 = r847680 / r847687;
        double r847689 = r847677 + r847688;
        double r847690 = r847676 ? r847685 : r847689;
        return r847690;
}

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.2
Target2.2
Herbie1.9
\[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 < -7.07003647724086e-303 or 1.2056496387991007e-37 < t

    1. Initial program 7.0

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

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

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

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

    if -7.07003647724086e-303 < t < 1.2056496387991007e-37

    1. Initial program 2.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -7.07003647724086002 \cdot 10^{-303} \lor \neg \left(t \le 1.2056496387991007 \cdot 10^{-37}\right):\\ \;\;\;\;x + \frac{\frac{y}{t}}{\frac{1}{z - x}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{t}{y \cdot \left(z - x\right)}}\\ \end{array}\]

Reproduce

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