Average Error: 6.3 → 1.5
Time: 11.7s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -4.029149003138143098746309211499089505365 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;a \le 2.332708162816437411754630123296212018574 \cdot 10^{-89}:\\ \;\;\;\;x + \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y}{\frac{a}{z - t}}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;a \le -4.029149003138143098746309211499089505365 \cdot 10^{64}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r259996 = x;
        double r259997 = y;
        double r259998 = z;
        double r259999 = t;
        double r260000 = r259998 - r259999;
        double r260001 = r259997 * r260000;
        double r260002 = a;
        double r260003 = r260001 / r260002;
        double r260004 = r259996 + r260003;
        return r260004;
}

double f(double x, double y, double z, double t, double a) {
        double r260005 = a;
        double r260006 = -4.029149003138143e+64;
        bool r260007 = r260005 <= r260006;
        double r260008 = x;
        double r260009 = y;
        double r260010 = r260009 / r260005;
        double r260011 = z;
        double r260012 = t;
        double r260013 = r260011 - r260012;
        double r260014 = r260010 * r260013;
        double r260015 = r260008 + r260014;
        double r260016 = 2.3327081628164374e-89;
        bool r260017 = r260005 <= r260016;
        double r260018 = r260009 * r260013;
        double r260019 = r260018 / r260005;
        double r260020 = r260008 + r260019;
        double r260021 = r260005 / r260013;
        double r260022 = r260009 / r260021;
        double r260023 = r260008 + r260022;
        double r260024 = r260017 ? r260020 : r260023;
        double r260025 = r260007 ? r260015 : r260024;
        return r260025;
}

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.6
Herbie1.5
\[\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 3 regimes
  2. if a < -4.029149003138143e+64

    1. Initial program 11.4

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

      \[\leadsto x + \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Using strategy rm
    5. Applied associate-/r/2.2

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

    if -4.029149003138143e+64 < a < 2.3327081628164374e-89

    1. Initial program 1.3

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

    if 2.3327081628164374e-89 < a

    1. Initial program 7.6

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

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

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

Reproduce

herbie shell --seed 2019305 
(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.07612662163899753e-10) (+ x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))

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