Average Error: 6.2 → 0.8
Time: 13.0s
Precision: 64
\[x + \frac{y \cdot \left(z - x\right)}{t}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.57164337169283755 \cdot 10^{297}:\\ \;\;\;\;\frac{z - x}{\frac{t}{y}} + x\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 1.83014942255142419 \cdot 10^{297}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{t}{z - x}} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.57164337169283755 \cdot 10^{297}:\\
\;\;\;\;\frac{z - x}{\frac{t}{y}} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r418581 = x;
        double r418582 = y;
        double r418583 = z;
        double r418584 = r418583 - r418581;
        double r418585 = r418582 * r418584;
        double r418586 = t;
        double r418587 = r418585 / r418586;
        double r418588 = r418581 + r418587;
        return r418588;
}

double f(double x, double y, double z, double t) {
        double r418589 = x;
        double r418590 = y;
        double r418591 = z;
        double r418592 = r418591 - r418589;
        double r418593 = r418590 * r418592;
        double r418594 = t;
        double r418595 = r418593 / r418594;
        double r418596 = r418589 + r418595;
        double r418597 = -3.5716433716928375e+297;
        bool r418598 = r418596 <= r418597;
        double r418599 = r418594 / r418590;
        double r418600 = r418592 / r418599;
        double r418601 = r418600 + r418589;
        double r418602 = 1.8301494225514242e+297;
        bool r418603 = r418596 <= r418602;
        double r418604 = r418594 / r418592;
        double r418605 = r418590 / r418604;
        double r418606 = r418605 + r418589;
        double r418607 = r418603 ? r418596 : r418606;
        double r418608 = r418598 ? r418601 : r418607;
        return r418608;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (+ x (/ (* y (- z x)) t)) < -3.5716433716928375e+297

    1. Initial program 51.7

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

      \[\leadsto x + \color{blue}{\left(y \cdot \left(z - x\right)\right) \cdot \frac{1}{t}}\]
    4. Using strategy rm
    5. Applied pow151.7

      \[\leadsto x + \left(y \cdot \left(z - x\right)\right) \cdot \color{blue}{{\left(\frac{1}{t}\right)}^{1}}\]
    6. Applied pow151.7

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

      \[\leadsto x + \left(\color{blue}{{y}^{1}} \cdot {\left(z - x\right)}^{1}\right) \cdot {\left(\frac{1}{t}\right)}^{1}\]
    8. Applied pow-prod-down51.7

      \[\leadsto x + \color{blue}{{\left(y \cdot \left(z - x\right)\right)}^{1}} \cdot {\left(\frac{1}{t}\right)}^{1}\]
    9. Applied pow-prod-down51.7

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

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

    if -3.5716433716928375e+297 < (+ x (/ (* y (- z x)) t)) < 1.8301494225514242e+297

    1. Initial program 0.6

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

    if 1.8301494225514242e+297 < (+ x (/ (* y (- z x)) t))

    1. Initial program 53.1

      \[x + \frac{y \cdot \left(z - x\right)}{t}\]
    2. Simplified1.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)}\]
    3. Using strategy rm
    4. Applied fma-udef1.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{y \cdot \left(z - x\right)}{t} \le -3.57164337169283755 \cdot 10^{297}:\\ \;\;\;\;\frac{z - x}{\frac{t}{y}} + x\\ \mathbf{elif}\;x + \frac{y \cdot \left(z - x\right)}{t} \le 1.83014942255142419 \cdot 10^{297}:\\ \;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{y}{\frac{t}{z - x}} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2020046 +o rules:numerics
(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)))