Average Error: 6.2 → 0.6
Time: 20.9s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.133815540329072515331313444009655574299 \cdot 10^{-27}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \le 1.037159489055861532938551677255652235485 \cdot 10^{-36}:\\ \;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\ \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 \le -1.133815540329072515331313444009655574299 \cdot 10^{-27}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r15940773 = x;
        double r15940774 = y;
        double r15940775 = z;
        double r15940776 = t;
        double r15940777 = r15940775 - r15940776;
        double r15940778 = r15940774 * r15940777;
        double r15940779 = a;
        double r15940780 = r15940778 / r15940779;
        double r15940781 = r15940773 - r15940780;
        return r15940781;
}

double f(double x, double y, double z, double t, double a) {
        double r15940782 = y;
        double r15940783 = -1.1338155403290725e-27;
        bool r15940784 = r15940782 <= r15940783;
        double r15940785 = x;
        double r15940786 = a;
        double r15940787 = z;
        double r15940788 = t;
        double r15940789 = r15940787 - r15940788;
        double r15940790 = r15940786 / r15940789;
        double r15940791 = r15940782 / r15940790;
        double r15940792 = r15940785 - r15940791;
        double r15940793 = 1.0371594890558615e-36;
        bool r15940794 = r15940782 <= r15940793;
        double r15940795 = r15940789 * r15940782;
        double r15940796 = r15940795 / r15940786;
        double r15940797 = r15940785 - r15940796;
        double r15940798 = r15940794 ? r15940797 : r15940792;
        double r15940799 = r15940784 ? r15940792 : r15940798;
        return r15940799;
}

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.6
\[\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 y < -1.1338155403290725e-27 or 1.0371594890558615e-36 < y

    1. Initial program 13.5

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

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

    if -1.1338155403290725e-27 < y < 1.0371594890558615e-36

    1. Initial program 0.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.133815540329072515331313444009655574299 \cdot 10^{-27}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;y \le 1.037159489055861532938551677255652235485 \cdot 10^{-36}:\\ \;\;\;\;x - \frac{\left(z - t\right) \cdot y}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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