Average Error: 6.3 → 0.5
Time: 11.7s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.379101084965972332411855839970124506105 \cdot 10^{193}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.839548675251690711463910215185810680095 \cdot 10^{215}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{a} \cdot y\\ \end{array}\]
x - \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;y \cdot \left(z - t\right) \le -2.379101084965972332411855839970124506105 \cdot 10^{193}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r249782 = x;
        double r249783 = y;
        double r249784 = z;
        double r249785 = t;
        double r249786 = r249784 - r249785;
        double r249787 = r249783 * r249786;
        double r249788 = a;
        double r249789 = r249787 / r249788;
        double r249790 = r249782 - r249789;
        return r249790;
}

double f(double x, double y, double z, double t, double a) {
        double r249791 = y;
        double r249792 = z;
        double r249793 = t;
        double r249794 = r249792 - r249793;
        double r249795 = r249791 * r249794;
        double r249796 = -2.3791010849659723e+193;
        bool r249797 = r249795 <= r249796;
        double r249798 = x;
        double r249799 = a;
        double r249800 = r249799 / r249794;
        double r249801 = r249791 / r249800;
        double r249802 = r249798 - r249801;
        double r249803 = 3.839548675251691e+215;
        bool r249804 = r249795 <= r249803;
        double r249805 = r249795 / r249799;
        double r249806 = r249798 - r249805;
        double r249807 = r249794 / r249799;
        double r249808 = r249807 * r249791;
        double r249809 = r249798 - r249808;
        double r249810 = r249804 ? r249806 : r249809;
        double r249811 = r249797 ? r249802 : r249810;
        return r249811;
}

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.3
Target0.6
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)) < -2.3791010849659723e+193

    1. Initial program 27.0

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

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

    if -2.3791010849659723e+193 < (* y (- z t)) < 3.839548675251691e+215

    1. Initial program 0.4

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

    if 3.839548675251691e+215 < (* y (- z t))

    1. Initial program 31.8

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Taylor expanded around 0 31.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -2.379101084965972332411855839970124506105 \cdot 10^{193}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 3.839548675251690711463910215185810680095 \cdot 10^{215}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{a} \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 2019305 
(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.07612662163899753e-10) (- x (/ 1 (/ (/ a (- z t)) y))) (if (< y 2.8944268627920891e-49) (- x (/ (* y (- z t)) a)) (- x (/ y (/ a (- z t))))))

  (- x (/ (* y (- z t)) a)))