Average Error: 5.7 → 0.6
Time: 16.4s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -6.4435085564630181 \cdot 10^{176} \lor \neg \left(y \cdot \left(z - t\right) \le 3.04984407197611456 \cdot 10^{197}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -6.4435085564630181 \cdot 10^{176} \lor \neg \left(y \cdot \left(z - t\right) \le 3.04984407197611456 \cdot 10^{197}\right):\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r248520 = x;
        double r248521 = y;
        double r248522 = z;
        double r248523 = t;
        double r248524 = r248522 - r248523;
        double r248525 = r248521 * r248524;
        double r248526 = a;
        double r248527 = r248525 / r248526;
        double r248528 = r248520 - r248527;
        return r248528;
}

double f(double x, double y, double z, double t, double a) {
        double r248529 = y;
        double r248530 = z;
        double r248531 = t;
        double r248532 = r248530 - r248531;
        double r248533 = r248529 * r248532;
        double r248534 = -6.443508556463018e+176;
        bool r248535 = r248533 <= r248534;
        double r248536 = 3.0498440719761146e+197;
        bool r248537 = r248533 <= r248536;
        double r248538 = !r248537;
        bool r248539 = r248535 || r248538;
        double r248540 = x;
        double r248541 = a;
        double r248542 = r248532 / r248541;
        double r248543 = r248529 * r248542;
        double r248544 = r248540 - r248543;
        double r248545 = r248533 / r248541;
        double r248546 = r248540 - r248545;
        double r248547 = r248539 ? r248544 : r248546;
        return r248547;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.7
Target0.6
Herbie0.6
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753 \cdot 10^{-10}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.8944268627920891 \cdot 10^{-49}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if (* y (- z t)) < -6.443508556463018e+176 or 3.0498440719761146e+197 < (* y (- z t))

    1. Initial program 25.3

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

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

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

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

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

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

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

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

    if -6.443508556463018e+176 < (* y (- z t)) < 3.0498440719761146e+197

    1. Initial program 0.4

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -6.4435085564630181 \cdot 10^{176} \lor \neg \left(y \cdot \left(z - t\right) \le 3.04984407197611456 \cdot 10^{197}\right):\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019198 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"

  :herbie-target
  (if (< y -1.0761266216389975e-10) (- x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

  (- x (/ (* y (- z t)) a)))