Average Error: 6.4 → 0.5
Time: 3.7s
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 code(double x, double y, double z, double t, double a) {
	return (x - ((y * (z - t)) / a));
}
double code(double x, double y, double z, double t, double a) {
	double temp;
	if (((y * (z - t)) <= -5.275596583469645e+271)) {
		temp = (x - (1.0 / ((a / y) / (z - t))));
	} else {
		double temp_1;
		if (((y * (z - t)) <= 1.7291969151590682e+262)) {
			temp_1 = (x - (1.0 / (a * (1.0 / (y * (z - t))))));
		} else {
			temp_1 = (x - (y / (a / (z - t))));
		}
		temp = temp_1;
	}
	return temp;
}

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)))