Average Error: 25.1 → 15.3
Time: 2.2m
Precision: 64
Internal Precision: 320
$\frac{1 - y}{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}$
$\begin{array}{l} \mathbf{if}\;y \le -3.322168255576266 \cdot 10^{+46}:\\ \;\;\;\;1\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{1 - y}{\sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}}{\sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if y < -3.322168255576266e+46

1. Initial program 37.7

$\frac{1 - y}{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}$
2. Taylor expanded around -inf 0.8

$\leadsto \color{blue}{1}$

## if -3.322168255576266e+46 < y

1. Initial program 20.4

$\frac{1 - y}{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}$
2. Using strategy rm

$\leadsto \frac{1 - y}{\sqrt{\color{blue}{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}} \cdot \sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}}$
4. Applied sqrt-prod20.6

$\leadsto \frac{1 - y}{\color{blue}{\sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}} \cdot \sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}}$
5. Applied associate-/r*20.6

$\leadsto \color{blue}{\frac{\frac{1 - y}{\sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}}{\sqrt{\sqrt{\frac{p}{y} + {\left(1 - y\right)}^{2}}}}}$
3. Recombined 2 regimes into one program.

# Runtime

Time bar (total: 2.2m)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (y p)
:name "(1-y)/sqrt(p/y +(1-y)^2)"
(/ (- 1 y) (sqrt (+ (/ p y) (pow (- 1 y) 2)))))