Average Error: 6.0 → 0.7
Time: 10.8s
Precision: 64
\[x - \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -1.8751699245657391 \cdot 10^{-66}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 4.31982997053434557 \cdot 10^{28}:\\ \;\;\;\;x - \left(\frac{z \cdot y}{a} - \frac{t \cdot y}{a}\right)\\ \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}\;a \le -1.8751699245657391 \cdot 10^{-66}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r363974 = x;
        double r363975 = y;
        double r363976 = z;
        double r363977 = t;
        double r363978 = r363976 - r363977;
        double r363979 = r363975 * r363978;
        double r363980 = a;
        double r363981 = r363979 / r363980;
        double r363982 = r363974 - r363981;
        return r363982;
}

double f(double x, double y, double z, double t, double a) {
        double r363983 = a;
        double r363984 = -1.875169924565739e-66;
        bool r363985 = r363983 <= r363984;
        double r363986 = x;
        double r363987 = y;
        double r363988 = z;
        double r363989 = t;
        double r363990 = r363988 - r363989;
        double r363991 = r363983 / r363990;
        double r363992 = r363987 / r363991;
        double r363993 = r363986 - r363992;
        double r363994 = 4.319829970534346e+28;
        bool r363995 = r363983 <= r363994;
        double r363996 = r363988 * r363987;
        double r363997 = r363996 / r363983;
        double r363998 = r363989 * r363987;
        double r363999 = r363998 / r363983;
        double r364000 = r363997 - r363999;
        double r364001 = r363986 - r364000;
        double r364002 = r363990 / r363983;
        double r364003 = r364002 * r363987;
        double r364004 = r363986 - r364003;
        double r364005 = r363995 ? r364001 : r364004;
        double r364006 = r363985 ? r363993 : r364005;
        return r364006;
}

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.0
Target0.6
Herbie0.7
\[\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 a < -1.875169924565739e-66

    1. Initial program 7.6

      \[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.875169924565739e-66 < a < 4.319829970534346e+28

    1. Initial program 0.8

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

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

      \[\leadsto x - \color{blue}{\frac{z - t}{\frac{a}{y}}}\]
    4. Using strategy rm
    5. Applied div-sub3.9

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

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

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

    if 4.319829970534346e+28 < a

    1. Initial program 10.0

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.8751699245657391 \cdot 10^{-66}:\\ \;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\ \mathbf{elif}\;a \le 4.31982997053434557 \cdot 10^{28}:\\ \;\;\;\;x - \left(\frac{z \cdot y}{a} - \frac{t \cdot y}{a}\right)\\ \mathbf{else}:\\ \;\;\;\;x - \frac{z - t}{a} \cdot y\\ \end{array}\]

Reproduce

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