Average Error: 5.9 → 1.2
Time: 6.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 r462115 = x;
        double r462116 = y;
        double r462117 = z;
        double r462118 = t;
        double r462119 = r462117 - r462118;
        double r462120 = r462116 * r462119;
        double r462121 = a;
        double r462122 = r462120 / r462121;
        double r462123 = r462115 + r462122;
        return r462123;
}

double f(double x, double y, double z, double t, double a) {
        double r462124 = a;
        double r462125 = -1.3995028580527438e+104;
        bool r462126 = r462124 <= r462125;
        double r462127 = x;
        double r462128 = y;
        double r462129 = z;
        double r462130 = t;
        double r462131 = r462129 - r462130;
        double r462132 = r462124 / r462131;
        double r462133 = r462128 / r462132;
        double r462134 = r462127 + r462133;
        double r462135 = 3.7574005919343346e+65;
        bool r462136 = r462124 <= r462135;
        double r462137 = r462128 * r462131;
        double r462138 = r462137 / r462124;
        double r462139 = r462127 + r462138;
        double r462140 = r462131 / r462124;
        double r462141 = r462128 * r462140;
        double r462142 = r462127 + r462141;
        double r462143 = r462136 ? r462139 : r462142;
        double r462144 = r462126 ? r462134 : r462143;
        return r462144;
}

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