Average Error: 29.1 → 18.2
Time: 14.0s
Precision: 64
$x \cdot \sqrt{1 + \frac{y \cdot y}{x \cdot x}}$
$\begin{array}{l} \mathbf{if}\;y \le -2.518363037219464657433757467205276251567 \cdot 10^{252} \lor \neg \left(y \le 82901678977054453262963606178964176896 \lor \neg \left(y \le 1.194639218472362803868971545661619843887 \cdot 10^{148}\right) \land y \le 7.227999850120798253457479486260775866056 \cdot 10^{214}\right):\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\\ \end{array}$
x \cdot \sqrt{1 + \frac{y \cdot y}{x \cdot x}}
\begin{array}{l}
\mathbf{if}\;y \le -2.518363037219464657433757467205276251567 \cdot 10^{252} \lor \neg \left(y \le 82901678977054453262963606178964176896 \lor \neg \left(y \le 1.194639218472362803868971545661619843887 \cdot 10^{148}\right) \land y \le 7.227999850120798253457479486260775866056 \cdot 10^{214}\right):\\
\;\;\;\;y\\

\mathbf{else}:\\
\;\;\;\;x \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\\

\end{array}
double f(double x, double y) {
double r2255416 = x;
double r2255417 = 1.0;
double r2255418 = y;
double r2255419 = r2255418 * r2255418;
double r2255420 = r2255416 * r2255416;
double r2255421 = r2255419 / r2255420;
double r2255422 = r2255417 + r2255421;
double r2255423 = sqrt(r2255422);
double r2255424 = r2255416 * r2255423;
return r2255424;
}


double f(double x, double y) {
double r2255425 = y;
double r2255426 = -2.5183630372194647e+252;
bool r2255427 = r2255425 <= r2255426;
double r2255428 = 8.290167897705445e+37;
bool r2255429 = r2255425 <= r2255428;
double r2255430 = 1.1946392184723628e+148;
bool r2255431 = r2255425 <= r2255430;
double r2255432 = !r2255431;
double r2255433 = 7.227999850120798e+214;
bool r2255434 = r2255425 <= r2255433;
bool r2255435 = r2255432 && r2255434;
bool r2255436 = r2255429 || r2255435;
double r2255437 = !r2255436;
bool r2255438 = r2255427 || r2255437;
double r2255439 = x;
double r2255440 = 1.0;
double r2255441 = r2255425 / r2255439;
double r2255442 = r2255441 * r2255441;
double r2255443 = r2255440 + r2255442;
double r2255444 = sqrt(r2255443);
double r2255445 = r2255439 * r2255444;
double r2255446 = r2255438 ? r2255425 : r2255445;
return r2255446;
}



# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if y < -2.5183630372194647e+252 or 8.290167897705445e+37 < y < 1.1946392184723628e+148 or 7.227999850120798e+214 < y

1. Initial program 47.0

$x \cdot \sqrt{1 + \frac{y \cdot y}{x \cdot x}}$
2. Taylor expanded around 0 38.7

$\leadsto \color{blue}{y}$

## if -2.5183630372194647e+252 < y < 8.290167897705445e+37 or 1.1946392184723628e+148 < y < 7.227999850120798e+214

1. Initial program 24.3

$x \cdot \sqrt{1 + \frac{y \cdot y}{x \cdot x}}$
2. Using strategy rm
3. Applied times-frac12.7

$\leadsto x \cdot \sqrt{1 + \color{blue}{\frac{y}{x} \cdot \frac{y}{x}}}$
3. Recombined 2 regimes into one program.
4. Final simplification18.2

$\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.518363037219464657433757467205276251567 \cdot 10^{252} \lor \neg \left(y \le 82901678977054453262963606178964176896 \lor \neg \left(y \le 1.194639218472362803868971545661619843887 \cdot 10^{148}\right) \land y \le 7.227999850120798253457479486260775866056 \cdot 10^{214}\right):\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;x \cdot \sqrt{1 + \frac{y}{x} \cdot \frac{y}{x}}\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (x y)
:name "x * sqrt(1 + (y * y) / (x * x))"
:precision binary64
(* x (sqrt (+ 1 (/ (* y y) (* x x))))))