Average Error: 6.2 → 1.6
Time: 7.9s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} \le -1.07630036810472099 \cdot 10^{285} \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a} \le 1.3164783215299771 \cdot 10^{227}\right):\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} \le -1.07630036810472099 \cdot 10^{285} \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a} \le 1.3164783215299771 \cdot 10^{227}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

\mathbf{else}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r335981 = x;
        double r335982 = y;
        double r335983 = z;
        double r335984 = t;
        double r335985 = r335983 - r335984;
        double r335986 = r335982 * r335985;
        double r335987 = a;
        double r335988 = r335986 / r335987;
        double r335989 = r335981 - r335988;
        return r335989;
}

double f(double x, double y, double z, double t, double a) {
        double r335990 = y;
        double r335991 = z;
        double r335992 = t;
        double r335993 = r335991 - r335992;
        double r335994 = r335990 * r335993;
        double r335995 = a;
        double r335996 = r335994 / r335995;
        double r335997 = -1.076300368104721e+285;
        bool r335998 = r335996 <= r335997;
        double r335999 = 1.3164783215299771e+227;
        bool r336000 = r335996 <= r335999;
        double r336001 = !r336000;
        bool r336002 = r335998 || r336001;
        double r336003 = x;
        double r336004 = r335995 / r335993;
        double r336005 = r335990 / r336004;
        double r336006 = r336003 - r336005;
        double r336007 = r336003 - r335996;
        double r336008 = r336002 ? r336006 : r336007;
        return r336008;
}

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.6
\[\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 2 regimes
  2. if (/ (* y (- z t)) a) < -1.076300368104721e+285 or 1.3164783215299771e+227 < (/ (* y (- z t)) a)

    1. Initial program 39.6

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

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

    if -1.076300368104721e+285 < (/ (* y (- z t)) a) < 1.3164783215299771e+227

    1. Initial program 0.3

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{y \cdot \left(z - t\right)}{a} \le -1.07630036810472099 \cdot 10^{285} \lor \neg \left(\frac{y \cdot \left(z - t\right)}{a} \le 1.3164783215299771 \cdot 10^{227}\right):\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020020 +o rules:numerics
(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)))