Average Error: 35.8 → 24.5
Time: 6.8s
Precision: 64
Internal Precision: 320
$\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}$
$\begin{array}{l} \mathbf{if}\;a \le -5.77126452019715 \cdot 10^{+140}:\\ \;\;\;\;-a\\ \mathbf{elif}\;a \le 1.6019685912508635 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\left(a \cdot a + c \cdot c\right) + b \cdot b}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if a < -5.77126452019715e+140

1. Initial program 56.3

$\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}$
2. Initial simplification56.3

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

$\leadsto \color{blue}{-1 \cdot a}$
4. Simplified15.6

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

## if -5.77126452019715e+140 < a < 1.6019685912508635e+155

1. Initial program 28.0

$\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}$
2. Initial simplification28.0

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

## if 1.6019685912508635e+155 < a

1. Initial program 59.2

$\sqrt{\left(a \cdot a + b \cdot b\right) + c \cdot c}$
2. Initial simplification59.2

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

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

$\leadsto \begin{array}{l} \mathbf{if}\;a \le -5.77126452019715 \cdot 10^{+140}:\\ \;\;\;\;-a\\ \mathbf{elif}\;a \le 1.6019685912508635 \cdot 10^{+155}:\\ \;\;\;\;\sqrt{\left(a \cdot a + c \cdot c\right) + b \cdot b}\\ \mathbf{else}:\\ \;\;\;\;a\\ \end{array}$

# Runtime

Time bar (total: 6.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (a b c)
:name "sqrt(a*a+b*b+c*c)"
(sqrt (+ (+ (* a a) (* b b)) (* c c))))