Average Error: 6.4 → 1.1
Time: 4.6s
Precision: 64
\[x + \frac{y \cdot \left(z - t\right)}{a}\]
\[\begin{array}{l} \mathbf{if}\;a \le -7.85605156347425887 \cdot 10^{86}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}\\ \mathbf{elif}\;a \le 1.75993203164165999 \cdot 10^{-29}:\\ \;\;\;\;x + \frac{1}{a} \cdot \left(\left(z - t\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
\mathbf{if}\;a \le -7.85605156347425887 \cdot 10^{86}:\\
\;\;\;\;x + \frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}\\

\mathbf{elif}\;a \le 1.75993203164165999 \cdot 10^{-29}:\\
\;\;\;\;x + \frac{1}{a} \cdot \left(\left(z - t\right) \cdot y\right)\\

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

\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 ((a <= -7.856051563474259e+86)) {
		temp = (x + ((y / (cbrt(a) * cbrt(a))) * ((z - t) / cbrt(a))));
	} else {
		double temp_1;
		if ((a <= 1.75993203164166e-29)) {
			temp_1 = (x + ((1.0 / a) * ((z - t) * y)));
		} else {
			temp_1 = (x + (y * ((z - t) / a)));
		}
		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
Herbie1.1
\[\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 < -7.856051563474259e+86

    1. Initial program 12.1

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

      \[\leadsto x + \frac{y \cdot \left(z - t\right)}{\color{blue}{\left(\sqrt[3]{a} \cdot \sqrt[3]{a}\right) \cdot \sqrt[3]{a}}}\]
    4. Applied times-frac1.3

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

    if -7.856051563474259e+86 < a < 1.75993203164166e-29

    1. Initial program 1.4

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

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

      \[\leadsto x + \frac{1}{\color{blue}{\frac{\frac{a}{y}}{z - t}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity2.9

      \[\leadsto x + \frac{1}{\frac{\frac{a}{y}}{\color{blue}{1 \cdot \left(z - t\right)}}}\]
    8. Applied div-inv2.9

      \[\leadsto x + \frac{1}{\frac{\color{blue}{a \cdot \frac{1}{y}}}{1 \cdot \left(z - t\right)}}\]
    9. Applied times-frac1.5

      \[\leadsto x + \frac{1}{\color{blue}{\frac{a}{1} \cdot \frac{\frac{1}{y}}{z - t}}}\]
    10. Applied add-cube-cbrt1.5

      \[\leadsto x + \frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\frac{a}{1} \cdot \frac{\frac{1}{y}}{z - t}}\]
    11. Applied times-frac1.6

      \[\leadsto x + \color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\frac{a}{1}} \cdot \frac{\sqrt[3]{1}}{\frac{\frac{1}{y}}{z - t}}}\]
    12. Simplified1.6

      \[\leadsto x + \color{blue}{\frac{1}{a}} \cdot \frac{\sqrt[3]{1}}{\frac{\frac{1}{y}}{z - t}}\]
    13. Simplified1.4

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

    if 1.75993203164166e-29 < a

    1. Initial program 9.1

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -7.85605156347425887 \cdot 10^{86}:\\ \;\;\;\;x + \frac{y}{\sqrt[3]{a} \cdot \sqrt[3]{a}} \cdot \frac{z - t}{\sqrt[3]{a}}\\ \mathbf{elif}\;a \le 1.75993203164165999 \cdot 10^{-29}:\\ \;\;\;\;x + \frac{1}{a} \cdot \left(\left(z - t\right) \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;x + y \cdot \frac{z - t}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 2020060 
(FPCore (x y z t a)
  :name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
  :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)))