Average Error: 35.1 → 23.6
Time: 12.5s
Precision: 64
$\sqrt{\left({a}^{2} + {b}^{2}\right) + {c}^{2}}$
$\begin{array}{l} \mathbf{if}\;a \le -1.3484959318131997 \cdot 10^{+154}:\\ \;\;\;\;-a\\ \mathbf{elif}\;a \le 3.6394667500160607 \cdot 10^{+124}:\\ \;\;\;\;\sqrt{c \cdot c + \left(b \cdot b + a \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}$
\sqrt{\left({a}^{2} + {b}^{2}\right) + {c}^{2}}
\begin{array}{l}
\mathbf{if}\;a \le -1.3484959318131997 \cdot 10^{+154}:\\
\;\;\;\;-a\\

\mathbf{elif}\;a \le 3.6394667500160607 \cdot 10^{+124}:\\
\;\;\;\;\sqrt{c \cdot c + \left(b \cdot b + a \cdot a\right)}\\

\mathbf{else}:\\
\;\;\;\;a\\

\end{array}
double f(double a, double b, double c) {
double r44748404 = a;
double r44748405 = 2.0;
double r44748406 = pow(r44748404, r44748405);
double r44748407 = b;
double r44748408 = pow(r44748407, r44748405);
double r44748409 = r44748406 + r44748408;
double r44748410 = c;
double r44748411 = pow(r44748410, r44748405);
double r44748412 = r44748409 + r44748411;
double r44748413 = sqrt(r44748412);
return r44748413;
}


double f(double a, double b, double c) {
double r44748414 = a;
double r44748415 = -1.3484959318131997e+154;
bool r44748416 = r44748414 <= r44748415;
double r44748417 = -r44748414;
double r44748418 = 3.6394667500160607e+124;
bool r44748419 = r44748414 <= r44748418;
double r44748420 = c;
double r44748421 = r44748420 * r44748420;
double r44748422 = b;
double r44748423 = r44748422 * r44748422;
double r44748424 = r44748414 * r44748414;
double r44748425 = r44748423 + r44748424;
double r44748426 = r44748421 + r44748425;
double r44748427 = sqrt(r44748426);
double r44748428 = r44748419 ? r44748427 : r44748414;
double r44748429 = r44748416 ? r44748417 : r44748428;
return r44748429;
}



# Try it out

Your Program's Arguments

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if a < -1.3484959318131997e+154

1. Initial program 59.2

$\sqrt{\left({a}^{2} + {b}^{2}\right) + {c}^{2}}$
2. Simplified59.2

$\leadsto \color{blue}{\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}}$
3. Taylor expanded around -inf 14.0

$\leadsto \color{blue}{-1 \cdot a}$
4. Simplified14.0

$\leadsto \color{blue}{-a}$

## if -1.3484959318131997e+154 < a < 3.6394667500160607e+124

1. Initial program 26.9

$\sqrt{\left({a}^{2} + {b}^{2}\right) + {c}^{2}}$
2. Simplified26.9

$\leadsto \color{blue}{\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}}$

## if 3.6394667500160607e+124 < a

1. Initial program 53.7

$\sqrt{\left({a}^{2} + {b}^{2}\right) + {c}^{2}}$
2. Simplified53.7

$\leadsto \color{blue}{\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}}$
3. Taylor expanded around inf 15.9

$\leadsto \color{blue}{a}$
3. Recombined 3 regimes into one program.
4. Final simplification23.6

$\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.3484959318131997 \cdot 10^{+154}:\\ \;\;\;\;-a\\ \mathbf{elif}\;a \le 3.6394667500160607 \cdot 10^{+124}:\\ \;\;\;\;\sqrt{c \cdot c + \left(b \cdot b + a \cdot a\right)}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}$

# Reproduce

herbie shell --seed 1
(FPCore (a b c)
:name "sqrt(pow(a,2) + pow(b,2) + pow(c,2))"
(sqrt (+ (+ (pow a 2) (pow b 2)) (pow c 2))))