Average Error: 24.8 → 11.2
Time: 10.0s
Precision: 64
$\frac{x}{\sqrt{{x}^{2} + {y}^{2}}}$
$\begin{array}{l} \mathbf{if}\;x \le -7.59297678514623 \cdot 10^{+84}:\\ \;\;\;\;\frac{x}{-x}\\ \mathbf{elif}\;x \le 1.943934747643532 \cdot 10^{+128}:\\ \;\;\;\;\frac{x}{\sqrt{x \cdot x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x}\\ \end{array}$
\frac{x}{\sqrt{{x}^{2} + {y}^{2}}}
\begin{array}{l}
\mathbf{if}\;x \le -7.59297678514623 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{-x}\\

\mathbf{elif}\;x \le 1.943934747643532 \cdot 10^{+128}:\\
\;\;\;\;\frac{x}{\sqrt{x \cdot x + y \cdot y}}\\

\mathbf{else}:\\
\;\;\;\;\frac{x}{x}\\

\end{array}
double f(double x, double y) {
double r54922199 = x;
double r54922200 = 2.0;
double r54922201 = pow(r54922199, r54922200);
double r54922202 = y;
double r54922203 = pow(r54922202, r54922200);
double r54922204 = r54922201 + r54922203;
double r54922205 = sqrt(r54922204);
double r54922206 = r54922199 / r54922205;
return r54922206;
}


double f(double x, double y) {
double r54922207 = x;
double r54922208 = -7.59297678514623e+84;
bool r54922209 = r54922207 <= r54922208;
double r54922210 = -r54922207;
double r54922211 = r54922207 / r54922210;
double r54922212 = 1.943934747643532e+128;
bool r54922213 = r54922207 <= r54922212;
double r54922214 = r54922207 * r54922207;
double r54922215 = y;
double r54922216 = r54922215 * r54922215;
double r54922217 = r54922214 + r54922216;
double r54922218 = sqrt(r54922217);
double r54922219 = r54922207 / r54922218;
double r54922220 = r54922207 / r54922207;
double r54922221 = r54922213 ? r54922219 : r54922220;
double r54922222 = r54922209 ? r54922211 : r54922221;
return r54922222;
}



Try it out

Results

 In Out
Enter valid numbers for all inputs

Derivation

1. Split input into 3 regimes
2. if x < -7.59297678514623e+84

1. Initial program 46.8

$\frac{x}{\sqrt{{x}^{2} + {y}^{2}}}$
2. Simplified46.8

$\leadsto \color{blue}{\frac{x}{\sqrt{x \cdot x + y \cdot y}}}$
3. Taylor expanded around -inf 10.3

$\leadsto \frac{x}{\color{blue}{-1 \cdot x}}$
4. Simplified10.3

$\leadsto \frac{x}{\color{blue}{-x}}$

if -7.59297678514623e+84 < x < 1.943934747643532e+128

1. Initial program 12.1

$\frac{x}{\sqrt{{x}^{2} + {y}^{2}}}$
2. Simplified12.1

$\leadsto \color{blue}{\frac{x}{\sqrt{x \cdot x + y \cdot y}}}$

if 1.943934747643532e+128 < x

1. Initial program 55.2

$\frac{x}{\sqrt{{x}^{2} + {y}^{2}}}$
2. Simplified55.2

$\leadsto \color{blue}{\frac{x}{\sqrt{x \cdot x + y \cdot y}}}$
3. Taylor expanded around inf 8.2

$\leadsto \frac{x}{\color{blue}{x}}$
3. Recombined 3 regimes into one program.
4. Final simplification11.2

$\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.59297678514623 \cdot 10^{+84}:\\ \;\;\;\;\frac{x}{-x}\\ \mathbf{elif}\;x \le 1.943934747643532 \cdot 10^{+128}:\\ \;\;\;\;\frac{x}{\sqrt{x \cdot x + y \cdot y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{x}\\ \end{array}$

Reproduce

herbie shell --seed 1
(FPCore (x y)
:name "x / sqrt(x^2 + y^2)"
(/ x (sqrt (+ (pow x 2) (pow y 2)))))