Average Error: 6.4 → 0.5
Time: 3.8s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -5.275596583469645 \cdot 10^{271}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\ \;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\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 -5.275596583469645 \cdot 10^{271}:\\
\;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\

\mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\
\;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\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 r344020 = x;
        double r344021 = y;
        double r344022 = z;
        double r344023 = t;
        double r344024 = r344022 - r344023;
        double r344025 = r344021 * r344024;
        double r344026 = a;
        double r344027 = r344025 / r344026;
        double r344028 = r344020 - r344027;
        return r344028;
}

double f(double x, double y, double z, double t, double a) {
        double r344029 = y;
        double r344030 = z;
        double r344031 = t;
        double r344032 = r344030 - r344031;
        double r344033 = r344029 * r344032;
        double r344034 = -5.275596583469645e+271;
        bool r344035 = r344033 <= r344034;
        double r344036 = x;
        double r344037 = 1.0;
        double r344038 = a;
        double r344039 = r344038 / r344029;
        double r344040 = r344039 / r344032;
        double r344041 = r344037 / r344040;
        double r344042 = r344036 - r344041;
        double r344043 = 1.7291969151590682e+262;
        bool r344044 = r344033 <= r344043;
        double r344045 = r344037 / r344033;
        double r344046 = r344038 * r344045;
        double r344047 = r344037 / r344046;
        double r344048 = r344036 - r344047;
        double r344049 = r344038 / r344032;
        double r344050 = r344029 / r344049;
        double r344051 = r344036 - r344050;
        double r344052 = r344044 ? r344048 : r344051;
        double r344053 = r344035 ? r344042 : r344052;
        return r344053;
}

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.4
Target0.7
Herbie0.5
\[\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)) < -5.275596583469645e+271

    1. Initial program 49.3

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied clear-num49.3

      \[\leadsto x - \color{blue}{\frac{1}{\frac{a}{y \cdot \left(z - t\right)}}}\]
    4. Using strategy rm
    5. Applied associate-/r*0.3

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

    if -5.275596583469645e+271 < (* y (- z t)) < 1.7291969151590682e+262

    1. Initial program 0.4

      \[x - \frac{y \cdot \left(z - t\right)}{a}\]
    2. Using strategy rm
    3. Applied clear-num0.5

      \[\leadsto x - \color{blue}{\frac{1}{\frac{a}{y \cdot \left(z - t\right)}}}\]
    4. Using strategy rm
    5. Applied div-inv0.5

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

    if 1.7291969151590682e+262 < (* y (- z t))

    1. Initial program 44.4

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \cdot \left(z - t\right) \le -5.275596583469645 \cdot 10^{271}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 1.72919691515906818 \cdot 10^{262}:\\ \;\;\;\;x - \frac{1}{a \cdot \frac{1}{y \cdot \left(z - t\right)}}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \end{array}\]

Reproduce

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