Average Error: 26.9 → 20.3
Time: 28.1s
Precision: 64
Internal Precision: 576
$\frac{vect0}{\sqrt{\left(vect0 \cdot vect0 + vect1 \cdot vect1\right) + vect2 \cdot vect2}}$
$\begin{array}{l} \mathbf{if}\;vect2 \le -1.1389257063951416 \cdot 10^{+154}:\\ \;\;\;\;\frac{vect0}{-vect2}\\ \mathbf{elif}\;vect2 \le 8.536728356663552 \cdot 10^{+90}:\\ \;\;\;\;\frac{vect0}{\sqrt{vect0 \cdot vect0 + \left(vect2 \cdot vect2 + vect1 \cdot vect1\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{vect0}{vect2}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if vect2 < -1.1389257063951416e+154

1. Initial program 38.1

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

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

$\leadsto \frac{vect0}{\color{blue}{-1 \cdot vect2}}$
4. Simplified11.9

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

## if -1.1389257063951416e+154 < vect2 < 8.536728356663552e+90

1. Initial program 23.1

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

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

## if 8.536728356663552e+90 < vect2

1. Initial program 33.6

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

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

$\leadsto \frac{vect0}{\color{blue}{vect2}}$
3. Recombined 3 regimes into one program.
4. Final simplification20.3

$\leadsto \begin{array}{l} \mathbf{if}\;vect2 \le -1.1389257063951416 \cdot 10^{+154}:\\ \;\;\;\;\frac{vect0}{-vect2}\\ \mathbf{elif}\;vect2 \le 8.536728356663552 \cdot 10^{+90}:\\ \;\;\;\;\frac{vect0}{\sqrt{vect0 \cdot vect0 + \left(vect2 \cdot vect2 + vect1 \cdot vect1\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{vect0}{vect2}\\ \end{array}$

# Runtime

Time bar (total: 28.1s)Debug log

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