Average Error: 5.9 → 1.2
Time: 8.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.39950285805274381 \cdot 10^{104}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 3.75740059193433464 \cdot 10^{65}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;a \le -1.39950285805274381 \cdot 10^{104}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r333734 = x;
        double r333735 = y;
        double r333736 = z;
        double r333737 = t;
        double r333738 = r333736 - r333737;
        double r333739 = r333735 * r333738;
        double r333740 = a;
        double r333741 = r333739 / r333740;
        double r333742 = r333734 + r333741;
        return r333742;
}

double f(double x, double y, double z, double t, double a) {
        double r333743 = a;
        double r333744 = -1.3995028580527438e+104;
        bool r333745 = r333743 <= r333744;
        double r333746 = x;
        double r333747 = y;
        double r333748 = z;
        double r333749 = t;
        double r333750 = r333748 - r333749;
        double r333751 = r333743 / r333750;
        double r333752 = r333747 / r333751;
        double r333753 = r333746 + r333752;
        double r333754 = 3.7574005919343346e+65;
        bool r333755 = r333743 <= r333754;
        double r333756 = r333747 * r333750;
        double r333757 = r333756 / r333743;
        double r333758 = r333746 + r333757;
        double r333759 = r333750 / r333743;
        double r333760 = r333747 * r333759;
        double r333761 = r333746 + r333760;
        double r333762 = r333755 ? r333758 : r333761;
        double r333763 = r333745 ? r333753 : r333762;
        return r333763;
}

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.9
Target0.7
Herbie1.2
\[\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 3 regimes
  2. if a < -1.3995028580527438e+104

    1. Initial program 12.4

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

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

    if -1.3995028580527438e+104 < a < 3.7574005919343346e+65

    1. Initial program 1.6

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

    if 3.7574005919343346e+65 < a

    1. Initial program 10.0

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.0

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

      \[\leadsto x + \color{blue}{\frac{y}{1} \cdot \frac{z - t}{a}}\]
    5. Simplified0.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.39950285805274381 \cdot 10^{104}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 3.75740059193433464 \cdot 10^{65}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

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

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

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