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

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

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

1. Initial program 56.3

$\sqrt{\left(vect0 \cdot vect0 + vect1 \cdot vect1\right) + vect2 \cdot vect2}$
2. Initial simplification56.3

$\leadsto \sqrt{\left(vect0 \cdot vect0 + vect2 \cdot vect2\right) + vect1 \cdot vect1}$
3. Taylor expanded around -inf 15.6

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

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

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

1. Initial program 28.0

$\sqrt{\left(vect0 \cdot vect0 + vect1 \cdot vect1\right) + vect2 \cdot vect2}$
2. Initial simplification28.0

$\leadsto \sqrt{\left(vect0 \cdot vect0 + vect2 \cdot vect2\right) + vect1 \cdot vect1}$

## if 1.6019685912508635e+155 < vect0

1. Initial program 59.2

$\sqrt{\left(vect0 \cdot vect0 + vect1 \cdot vect1\right) + vect2 \cdot vect2}$
2. Initial simplification59.2

$\leadsto \sqrt{\left(vect0 \cdot vect0 + vect2 \cdot vect2\right) + vect1 \cdot vect1}$
3. Taylor expanded around inf 13.4

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

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

# Runtime

Time bar (total: 7.4s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (vect0 vect1 vect2)
:name "sqrt(vect0 * vect0 + vect1 * vect1 + vect2 * vect2)"
(sqrt (+ (+ (* vect0 vect0) (* vect1 vect1)) (* vect2 vect2))))