Average Error: 6.1 → 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 -1.072477392905936259338670588486610754203 \cdot 10^{217}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 7.843751749471894793264472097780927032588 \cdot 10^{196}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{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 -1.072477392905936259338670588486610754203 \cdot 10^{217}:\\
\;\;\;\;x - y \cdot \frac{z - t}{a}\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r313654 = x;
        double r313655 = y;
        double r313656 = z;
        double r313657 = t;
        double r313658 = r313656 - r313657;
        double r313659 = r313655 * r313658;
        double r313660 = a;
        double r313661 = r313659 / r313660;
        double r313662 = r313654 - r313661;
        return r313662;
}

double f(double x, double y, double z, double t, double a) {
        double r313663 = y;
        double r313664 = z;
        double r313665 = t;
        double r313666 = r313664 - r313665;
        double r313667 = r313663 * r313666;
        double r313668 = -1.0724773929059363e+217;
        bool r313669 = r313667 <= r313668;
        double r313670 = x;
        double r313671 = a;
        double r313672 = r313666 / r313671;
        double r313673 = r313663 * r313672;
        double r313674 = r313670 - r313673;
        double r313675 = 7.843751749471895e+196;
        bool r313676 = r313667 <= r313675;
        double r313677 = r313667 / r313671;
        double r313678 = r313670 - r313677;
        double r313679 = 1.0;
        double r313680 = r313671 / r313663;
        double r313681 = r313680 / r313666;
        double r313682 = r313679 / r313681;
        double r313683 = r313670 - r313682;
        double r313684 = r313676 ? r313678 : r313683;
        double r313685 = r313669 ? r313674 : r313684;
        return r313685;
}

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)) < -1.0724773929059363e+217

    1. Initial program 30.6

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

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

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

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

    if -1.0724773929059363e+217 < (* y (- z t)) < 7.843751749471895e+196

    1. Initial program 0.4

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

    if 7.843751749471895e+196 < (* y (- z t))

    1. Initial program 27.8

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

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

      \[\leadsto x - \frac{1}{\color{blue}{\frac{\frac{a}{y}}{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 -1.072477392905936259338670588486610754203 \cdot 10^{217}:\\ \;\;\;\;x - y \cdot \frac{z - t}{a}\\ \mathbf{elif}\;y \cdot \left(z - t\right) \le 7.843751749471894793264472097780927032588 \cdot 10^{196}:\\ \;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\ \mathbf{else}:\\ \;\;\;\;x - \frac{1}{\frac{\frac{a}{y}}{z - t}}\\ \end{array}\]

Reproduce

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