Average Error: 6.3 → 1.3
Time: 10.5s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 8.709696976931573596806654735929958388855 \cdot 10^{77}:\\ \;\;\;\;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 -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

\mathbf{elif}\;a \le 8.709696976931573596806654735929958388855 \cdot 10^{77}:\\
\;\;\;\;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 r372071 = x;
        double r372072 = y;
        double r372073 = z;
        double r372074 = t;
        double r372075 = r372073 - r372074;
        double r372076 = r372072 * r372075;
        double r372077 = a;
        double r372078 = r372076 / r372077;
        double r372079 = r372071 - r372078;
        return r372079;
}

double f(double x, double y, double z, double t, double a) {
        double r372080 = a;
        double r372081 = -9.089319465526927e-131;
        bool r372082 = r372080 <= r372081;
        double r372083 = x;
        double r372084 = y;
        double r372085 = z;
        double r372086 = t;
        double r372087 = r372085 - r372086;
        double r372088 = r372080 / r372087;
        double r372089 = r372084 / r372088;
        double r372090 = r372083 - r372089;
        double r372091 = 8.709696976931574e+77;
        bool r372092 = r372080 <= r372091;
        double r372093 = r372084 * r372087;
        double r372094 = r372093 / r372080;
        double r372095 = r372083 - r372094;
        double r372096 = r372087 / r372080;
        double r372097 = r372084 * r372096;
        double r372098 = r372083 - r372097;
        double r372099 = r372092 ? r372095 : r372098;
        double r372100 = r372082 ? r372090 : r372099;
        return r372100;
}

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
Herbie1.3
\[\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 < -9.089319465526927e-131

    1. Initial program 7.5

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

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

    if -9.089319465526927e-131 < a < 8.709696976931574e+77

    1. Initial program 1.3

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

    if 8.709696976931574e+77 < a

    1. Initial program 12.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -9.089319465526926619489567709796493780074 \cdot 10^{-131}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 8.709696976931573596806654735929958388855 \cdot 10^{77}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019350 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
  :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)))