Average Error: 6.3 → 0.4
Time: 4.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.5554972572940787 \cdot 10^{247}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.2077132525675212 \cdot 10^{265}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -2.5554972572940787 \cdot 10^{247}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r365717 = x;
        double r365718 = y;
        double r365719 = z;
        double r365720 = t;
        double r365721 = r365719 - r365720;
        double r365722 = r365718 * r365721;
        double r365723 = a;
        double r365724 = r365722 / r365723;
        double r365725 = r365717 + r365724;
        return r365725;
}

double f(double x, double y, double z, double t, double a) {
        double r365726 = y;
        double r365727 = z;
        double r365728 = t;
        double r365729 = r365727 - r365728;
        double r365730 = r365726 * r365729;
        double r365731 = -2.5554972572940787e+247;
        bool r365732 = r365730 <= r365731;
        double r365733 = x;
        double r365734 = a;
        double r365735 = r365729 / r365734;
        double r365736 = r365726 * r365735;
        double r365737 = r365733 + r365736;
        double r365738 = 3.2077132525675212e+265;
        bool r365739 = r365730 <= r365738;
        double r365740 = r365730 / r365734;
        double r365741 = r365733 + r365740;
        double r365742 = 1.0;
        double r365743 = r365734 / r365726;
        double r365744 = r365743 / r365729;
        double r365745 = r365742 / r365744;
        double r365746 = r365733 + r365745;
        double r365747 = r365739 ? r365741 : r365746;
        double r365748 = r365732 ? r365737 : r365747;
        return r365748;
}

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.3
Target0.7
Herbie0.4
\[\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 (- z t)) < -2.5554972572940787e+247

    1. Initial program 39.0

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

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

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

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

    if -2.5554972572940787e+247 < (* y (- z t)) < 3.2077132525675212e+265

    1. Initial program 0.4

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

    if 3.2077132525675212e+265 < (* y (- z t))

    1. Initial program 44.1

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

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

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

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

Reproduce

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