Average Error: 6.0 → 0.8
Time: 4.9s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -3.0637893463441613 \cdot 10^{62}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \le 4.0646321336868101 \cdot 10^{-14}:\\ \;\;\;\;x + \left(\frac{z \cdot y}{a} - \frac{t \cdot y}{a}\right)\\ \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}\;y \le -3.0637893463441613 \cdot 10^{62}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r322243 = x;
        double r322244 = y;
        double r322245 = z;
        double r322246 = t;
        double r322247 = r322245 - r322246;
        double r322248 = r322244 * r322247;
        double r322249 = a;
        double r322250 = r322248 / r322249;
        double r322251 = r322243 + r322250;
        return r322251;
}

double f(double x, double y, double z, double t, double a) {
        double r322252 = y;
        double r322253 = -3.0637893463441613e+62;
        bool r322254 = r322252 <= r322253;
        double r322255 = x;
        double r322256 = a;
        double r322257 = z;
        double r322258 = t;
        double r322259 = r322257 - r322258;
        double r322260 = r322256 / r322259;
        double r322261 = r322252 / r322260;
        double r322262 = r322255 + r322261;
        double r322263 = 4.06463213368681e-14;
        bool r322264 = r322252 <= r322263;
        double r322265 = r322257 * r322252;
        double r322266 = r322265 / r322256;
        double r322267 = r322258 * r322252;
        double r322268 = r322267 / r322256;
        double r322269 = r322266 - r322268;
        double r322270 = r322255 + r322269;
        double r322271 = r322259 / r322256;
        double r322272 = r322252 * r322271;
        double r322273 = r322255 + r322272;
        double r322274 = r322264 ? r322270 : r322273;
        double r322275 = r322254 ? r322262 : r322274;
        return r322275;
}

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.0
Target0.8
Herbie0.8
\[\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 y < -3.0637893463441613e+62

    1. Initial program 18.9

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

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

    if -3.0637893463441613e+62 < y < 4.06463213368681e-14

    1. Initial program 0.8

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

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

      \[\leadsto x + \color{blue}{\frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}}\]
    5. Taylor expanded around 0 0.8

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

    if 4.06463213368681e-14 < y

    1. Initial program 14.1

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

      \[\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 simplification0.8

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

Reproduce

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