Average Error: 6.1 → 0.5
Time: 23.8s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;\left(z - t\right) \cdot y = -\infty:\\ \;\;\;\;x + \frac{z - t}{a} \cdot y\\ \mathbf{elif}\;\left(z - t\right) \cdot y \le 4.602775554656434635046377876682959240373 \cdot 10^{138}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a} + x\\ \mathbf{else}:\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a} + x\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;\left(z - t\right) \cdot y = -\infty:\\
\;\;\;\;x + \frac{z - t}{a} \cdot y\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r21815675 = x;
        double r21815676 = y;
        double r21815677 = z;
        double r21815678 = t;
        double r21815679 = r21815677 - r21815678;
        double r21815680 = r21815676 * r21815679;
        double r21815681 = a;
        double r21815682 = r21815680 / r21815681;
        double r21815683 = r21815675 + r21815682;
        return r21815683;
}

double f(double x, double y, double z, double t, double a) {
        double r21815684 = z;
        double r21815685 = t;
        double r21815686 = r21815684 - r21815685;
        double r21815687 = y;
        double r21815688 = r21815686 * r21815687;
        double r21815689 = -inf.0;
        bool r21815690 = r21815688 <= r21815689;
        double r21815691 = x;
        double r21815692 = a;
        double r21815693 = r21815686 / r21815692;
        double r21815694 = r21815693 * r21815687;
        double r21815695 = r21815691 + r21815694;
        double r21815696 = 4.6027755546564346e+138;
        bool r21815697 = r21815688 <= r21815696;
        double r21815698 = r21815688 / r21815692;
        double r21815699 = r21815698 + r21815691;
        double r21815700 = r21815687 / r21815692;
        double r21815701 = r21815686 * r21815700;
        double r21815702 = r21815701 + r21815691;
        double r21815703 = r21815697 ? r21815699 : r21815702;
        double r21815704 = r21815690 ? r21815695 : r21815703;
        return r21815704;
}

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.1
Target0.7
Herbie0.5
\[\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 (* y (- z t)) < -inf.0

    1. Initial program 64.0

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

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

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

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

    if -inf.0 < (* y (- z t)) < 4.6027755546564346e+138

    1. Initial program 0.4

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

    if 4.6027755546564346e+138 < (* y (- z t))

    1. Initial program 20.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(z - t\right) \cdot y = -\infty:\\ \;\;\;\;x + \frac{z - t}{a} \cdot y\\ \mathbf{elif}\;\left(z - t\right) \cdot y \le 4.602775554656434635046377876682959240373 \cdot 10^{138}:\\ \;\;\;\;\frac{\left(z - t\right) \cdot y}{a} + x\\ \mathbf{else}:\\ \;\;\;\;\left(z - t\right) \cdot \frac{y}{a} + x\\ \end{array}\]

Reproduce

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

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