Average Error: 5.9 → 1.0
Time: 20.5s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \frac{z - t}{a} + x\\ \mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\ \;\;\;\;x + \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - t}{a} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\
\;\;\;\;y \cdot \frac{z - t}{a} + x\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r15829299 = x;
        double r15829300 = y;
        double r15829301 = z;
        double r15829302 = t;
        double r15829303 = r15829301 - r15829302;
        double r15829304 = r15829300 * r15829303;
        double r15829305 = a;
        double r15829306 = r15829304 / r15829305;
        double r15829307 = r15829299 + r15829306;
        return r15829307;
}

double f(double x, double y, double z, double t, double a) {
        double r15829308 = a;
        double r15829309 = -3.924024237876824e-14;
        bool r15829310 = r15829308 <= r15829309;
        double r15829311 = y;
        double r15829312 = z;
        double r15829313 = t;
        double r15829314 = r15829312 - r15829313;
        double r15829315 = r15829314 / r15829308;
        double r15829316 = r15829311 * r15829315;
        double r15829317 = x;
        double r15829318 = r15829316 + r15829317;
        double r15829319 = 1.8754865329867302e-85;
        bool r15829320 = r15829308 <= r15829319;
        double r15829321 = 1.0;
        double r15829322 = r15829311 * r15829314;
        double r15829323 = r15829308 / r15829322;
        double r15829324 = r15829321 / r15829323;
        double r15829325 = r15829317 + r15829324;
        double r15829326 = r15829320 ? r15829325 : r15829318;
        double r15829327 = r15829310 ? r15829318 : r15829326;
        return r15829327;
}

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.8
Herbie1.0
\[\begin{array}{l} \mathbf{if}\;y \lt -1.07612662163899753216593153715602325729 \cdot 10^{-10}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{z - t}}{y}}\\ \mathbf{elif}\;y \lt 2.894426862792089097262541964056085749132 \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 a < -3.924024237876824e-14 or 1.8754865329867302e-85 < a

    1. Initial program 8.1

      \[x + \frac{y \cdot \left(z - t\right)}{a}\]
    2. Taylor expanded around 0 8.1

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

      \[\leadsto x + \color{blue}{\frac{z - t}{\frac{a}{y}}}\]
    4. Taylor expanded around 0 8.1

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

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

    if -3.924024237876824e-14 < a < 1.8754865329867302e-85

    1. Initial program 0.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\ \;\;\;\;y \cdot \frac{z - t}{a} + x\\ \mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\ \;\;\;\;x + \frac{1}{\frac{a}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;y \cdot \frac{z - t}{a} + x\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 
(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)))