Average Error: 6.1 → 0.6
Time: 22.3s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.1598157602590286 \cdot 10^{43} \lor \neg \left(y \le 7.79103133515010313 \cdot 10^{41}\right):\\ \;\;\;\;x + \frac{z - t}{a} \cdot y\\ \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 \le -2.1598157602590286 \cdot 10^{43} \lor \neg \left(y \le 7.79103133515010313 \cdot 10^{41}\right):\\
\;\;\;\;x + \frac{z - t}{a} \cdot y\\

\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 r299444 = x;
        double r299445 = y;
        double r299446 = z;
        double r299447 = t;
        double r299448 = r299446 - r299447;
        double r299449 = r299445 * r299448;
        double r299450 = a;
        double r299451 = r299449 / r299450;
        double r299452 = r299444 + r299451;
        return r299452;
}

double f(double x, double y, double z, double t, double a) {
        double r299453 = y;
        double r299454 = -2.1598157602590286e+43;
        bool r299455 = r299453 <= r299454;
        double r299456 = 7.791031335150103e+41;
        bool r299457 = r299453 <= r299456;
        double r299458 = !r299457;
        bool r299459 = r299455 || r299458;
        double r299460 = x;
        double r299461 = z;
        double r299462 = t;
        double r299463 = r299461 - r299462;
        double r299464 = a;
        double r299465 = r299463 / r299464;
        double r299466 = r299465 * r299453;
        double r299467 = r299460 + r299466;
        double r299468 = r299453 * r299463;
        double r299469 = r299468 / r299464;
        double r299470 = r299460 + r299469;
        double r299471 = r299459 ? r299467 : r299470;
        return r299471;
}

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

Original6.1
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 < -2.1598157602590286e+43 or 7.791031335150103e+41 < y

    1. Initial program 18.1

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

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

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

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

      \[\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-down18.2

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

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

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

    if -2.1598157602590286e+43 < y < 7.791031335150103e+41

    1. Initial program 0.5

      \[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 \le -2.1598157602590286 \cdot 10^{43} \lor \neg \left(y \le 7.79103133515010313 \cdot 10^{41}\right):\\ \;\;\;\;x + \frac{z - t}{a} \cdot y\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

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

  :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)))