Average Error: 30.1 → 17.0
Time: 4.2s
Precision: 64
Internal Precision: 320
$\sqrt{vect0 \cdot vect0 + vect1 \cdot vect1}$
$\begin{array}{l} \mathbf{if}\;vect0 \le -5.147403001023096 \cdot 10^{+84}:\\ \;\;\;\;-vect0\\ \mathbf{elif}\;vect0 \le 1.7967825844854412 \cdot 10^{+130}:\\ \;\;\;\;\sqrt{vect0 \cdot vect0 + 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.147403001023096e+84

1. Initial program 45.3

$\sqrt{vect0 \cdot vect0 + vect1 \cdot vect1}$
2. Taylor expanded around -inf 10.5

$\leadsto \color{blue}{-1 \cdot vect0}$
3. Simplified10.5

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

## if -5.147403001023096e+84 < vect0 < 1.7967825844854412e+130

1. Initial program 20.5

$\sqrt{vect0 \cdot vect0 + vect1 \cdot vect1}$

## if 1.7967825844854412e+130 < vect0

1. Initial program 53.8

$\sqrt{vect0 \cdot vect0 + vect1 \cdot vect1}$
2. Taylor expanded around inf 9.7

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

$\leadsto \begin{array}{l} \mathbf{if}\;vect0 \le -5.147403001023096 \cdot 10^{+84}:\\ \;\;\;\;-vect0\\ \mathbf{elif}\;vect0 \le 1.7967825844854412 \cdot 10^{+130}:\\ \;\;\;\;\sqrt{vect0 \cdot vect0 + vect1 \cdot vect1}\\ \mathbf{else}:\\ \;\;\;\;vect0\\ \end{array}$

# Runtime

Time bar (total: 4.2s)Debug log

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