Average Error: 5.9 → 1.0
Time: 19.0s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\ \;\;\;\;x - \frac{1}{\frac{a}{\left(z - t\right) \cdot y}}\\ \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 -3.924024237876823705783609140341883486631 \cdot 10^{-14}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

\mathbf{elif}\;a \le 1.875486532986730162660285871460922359099 \cdot 10^{-85}:\\
\;\;\;\;x - \frac{1}{\frac{a}{\left(z - t\right) \cdot y}}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r15124860 = x;
        double r15124861 = y;
        double r15124862 = z;
        double r15124863 = t;
        double r15124864 = r15124862 - r15124863;
        double r15124865 = r15124861 * r15124864;
        double r15124866 = a;
        double r15124867 = r15124865 / r15124866;
        double r15124868 = r15124860 - r15124867;
        return r15124868;
}

double f(double x, double y, double z, double t, double a) {
        double r15124869 = a;
        double r15124870 = -3.924024237876824e-14;
        bool r15124871 = r15124869 <= r15124870;
        double r15124872 = x;
        double r15124873 = y;
        double r15124874 = z;
        double r15124875 = t;
        double r15124876 = r15124874 - r15124875;
        double r15124877 = r15124876 / r15124869;
        double r15124878 = r15124873 * r15124877;
        double r15124879 = r15124872 - r15124878;
        double r15124880 = 1.8754865329867302e-85;
        bool r15124881 = r15124869 <= r15124880;
        double r15124882 = 1.0;
        double r15124883 = r15124876 * r15124873;
        double r15124884 = r15124869 / r15124883;
        double r15124885 = r15124882 / r15124884;
        double r15124886 = r15124872 - r15124885;
        double r15124887 = r15124881 ? r15124886 : r15124879;
        double r15124888 = r15124871 ? r15124879 : r15124887;
        return r15124888;
}

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

Original5.9
Target0.8
Herbie1.0
\[\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 a < -3.924024237876824e-14 or 1.8754865329867302e-85 < a

    1. Initial program 8.1

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

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

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

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

    if -3.924024237876824e-14 < a < 1.8754865329867302e-85

    1. Initial program 0.9

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

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

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

Reproduce

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