Average Error: 23.5 → 18.8
Time: 15.6s
Precision: 64
Internal Precision: 2624
$\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}$
$\begin{array}{l} \mathbf{if}\;x \le 6.294595312968477 \cdot 10^{+146}:\\ \;\;\;\;\sqrt{0.5 + \log \left(e^{0.5 \cdot \frac{x}{\sqrt{x \cdot x + 4 \cdot \left(p \cdot p\right)}}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{0.5 \cdot x}{x} + 0.5}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if x < 6.294595312968477e+146

1. Initial program 20.5

$\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}$
2. Initial simplification20.6

$\leadsto \sqrt{\frac{0.5 \cdot x}{\sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}} + 0.5}$
3. Using strategy rm
4. Applied *-un-lft-identity20.6

$\leadsto \sqrt{\frac{0.5 \cdot x}{\color{blue}{1 \cdot \sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}}} + 0.5}$
5. Applied times-frac20.6

$\leadsto \sqrt{\color{blue}{\frac{0.5}{1} \cdot \frac{x}{\sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}}} + 0.5}$
6. Simplified20.6

$\leadsto \sqrt{\color{blue}{0.5} \cdot \frac{x}{\sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}} + 0.5}$
7. Using strategy rm

$\leadsto \sqrt{\color{blue}{\log \left(e^{0.5 \cdot \frac{x}{\sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}}}\right)} + 0.5}$

## if 6.294595312968477e+146 < x

1. Initial program 43.0

$\sqrt{0.5 \cdot \left(1 + \frac{x}{\sqrt{\left(4 \cdot p\right) \cdot p + x \cdot x}}\right)}$
2. Initial simplification43.0

$\leadsto \sqrt{\frac{0.5 \cdot x}{\sqrt{\left(p \cdot p\right) \cdot 4 + x \cdot x}} + 0.5}$
3. Taylor expanded around 0 7.3

$\leadsto \sqrt{\frac{0.5 \cdot x}{\color{blue}{x}} + 0.5}$
3. Recombined 2 regimes into one program.
4. Final simplification18.8

$\leadsto \begin{array}{l} \mathbf{if}\;x \le 6.294595312968477 \cdot 10^{+146}:\\ \;\;\;\;\sqrt{0.5 + \log \left(e^{0.5 \cdot \frac{x}{\sqrt{x \cdot x + 4 \cdot \left(p \cdot p\right)}}}\right)}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{0.5 \cdot x}{x} + 0.5}\\ \end{array}$

# Runtime

Time bar (total: 15.6s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x p)
:name "sqrt( 0.5 * (1 + x/(sqrt(4*p*p +x*x))))"
(sqrt (* 0.5 (+ 1 (/ x (sqrt (+ (* (* 4 p) p) (* x x))))))))