Average Error: 6.2 → 0.4
Time: 2.9s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.8448302221257819 \cdot 10^{209}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 4.77051970732716704 \cdot 10^{192}:\\ \;\;\;\;x - \left(\frac{z \cdot y}{a} - \frac{t \cdot y}{a}\right)\\ \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}\;y \cdot \left(z - t\right) \le -1.8448302221257819 \cdot 10^{209}:\\
\;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r367036 = x;
        double r367037 = y;
        double r367038 = z;
        double r367039 = t;
        double r367040 = r367038 - r367039;
        double r367041 = r367037 * r367040;
        double r367042 = a;
        double r367043 = r367041 / r367042;
        double r367044 = r367036 - r367043;
        return r367044;
}

double f(double x, double y, double z, double t, double a) {
        double r367045 = y;
        double r367046 = z;
        double r367047 = t;
        double r367048 = r367046 - r367047;
        double r367049 = r367045 * r367048;
        double r367050 = -1.844830222125782e+209;
        bool r367051 = r367049 <= r367050;
        double r367052 = x;
        double r367053 = a;
        double r367054 = r367045 / r367053;
        double r367055 = r367054 * r367048;
        double r367056 = r367052 - r367055;
        double r367057 = 4.770519707327167e+192;
        bool r367058 = r367049 <= r367057;
        double r367059 = r367046 * r367045;
        double r367060 = r367059 / r367053;
        double r367061 = r367047 * r367045;
        double r367062 = r367061 / r367053;
        double r367063 = r367060 - r367062;
        double r367064 = r367052 - r367063;
        double r367065 = r367053 / r367048;
        double r367066 = r367045 / r367065;
        double r367067 = r367052 - r367066;
        double r367068 = r367058 ? r367064 : r367067;
        double r367069 = r367051 ? r367056 : r367068;
        return r367069;
}

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
Herbie0.4
\[\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 3 regimes
  2. if (* y (- z t)) < -1.844830222125782e+209

    1. Initial program 30.2

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

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

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

    if -1.844830222125782e+209 < (* y (- z t)) < 4.770519707327167e+192

    1. Initial program 0.3

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

      \[\leadsto x - \color{blue}{\frac{y}{\frac{a}{z - t}}}\]
    4. Taylor expanded around 0 0.3

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

    if 4.770519707327167e+192 < (* y (- z t))

    1. Initial program 27.1

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -1.8448302221257819 \cdot 10^{209}:\\ \;\;\;\;x - \frac{y}{a} \cdot \left(z - t\right)\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 4.77051970732716704 \cdot 10^{192}:\\ \;\;\;\;x - \left(\frac{z \cdot y}{a} - \frac{t \cdot y}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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