Average Error: 6.2 → 1.1
Time: 21.5s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.545922735716026296945674028524282471671 \cdot 10^{124}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 6.578616508199666559589214477101321950077 \cdot 10^{-31}:\\ \;\;\;\;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}\;y \le -1.545922735716026296945674028524282471671 \cdot 10^{124}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;y \le 6.578616508199666559589214477101321950077 \cdot 10^{-31}:\\
\;\;\;\;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 r14340913 = x;
        double r14340914 = y;
        double r14340915 = z;
        double r14340916 = t;
        double r14340917 = r14340915 - r14340916;
        double r14340918 = r14340914 * r14340917;
        double r14340919 = a;
        double r14340920 = r14340918 / r14340919;
        double r14340921 = r14340913 - r14340920;
        return r14340921;
}

double f(double x, double y, double z, double t, double a) {
        double r14340922 = y;
        double r14340923 = -1.5459227357160263e+124;
        bool r14340924 = r14340922 <= r14340923;
        double r14340925 = x;
        double r14340926 = z;
        double r14340927 = t;
        double r14340928 = r14340926 - r14340927;
        double r14340929 = a;
        double r14340930 = r14340928 / r14340929;
        double r14340931 = r14340922 * r14340930;
        double r14340932 = r14340925 - r14340931;
        double r14340933 = 6.5786165081996666e-31;
        bool r14340934 = r14340922 <= r14340933;
        double r14340935 = r14340922 * r14340928;
        double r14340936 = r14340935 / r14340929;
        double r14340937 = r14340925 - r14340936;
        double r14340938 = r14340934 ? r14340937 : r14340932;
        double r14340939 = r14340924 ? r14340932 : r14340938;
        return r14340939;
}

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.2
Target0.7
Herbie1.1
\[\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 y < -1.5459227357160263e+124 or 6.5786165081996666e-31 < y

    1. Initial program 17.1

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

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

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

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

    if -1.5459227357160263e+124 < y < 6.5786165081996666e-31

    1. Initial program 1.3

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

      \[\leadsto x - \color{blue}{\frac{1}{\frac{a}{y \cdot \left(z - t\right)}}}\]
    4. Taylor expanded around 0 1.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.545922735716026296945674028524282471671 \cdot 10^{124}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \le 6.578616508199666559589214477101321950077 \cdot 10^{-31}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2019169 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"

  :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)))