Average Error: 32.9 → 19.8
Time: 1.7m
Precision: 64
Internal Precision: 320
$\frac{x - y}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}$
$\begin{array}{l} \mathbf{if}\;\frac{x - y}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \le -5.68878655196326 \cdot 10^{-310}:\\ \;\;\;\;\frac{1}{\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}} \cdot \frac{x - y}{\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}}\\ \mathbf{if}\;\frac{x - y}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \le 7.187370790730964 \cdot 10^{-272}:\\ \;\;\;\;\frac{x - y}{y - x}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{x - y}}{\sqrt{1}} \cdot \frac{\sqrt{x - y}}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 3 regimes
2. ## if (/ (- x y) (sqrt (+ (* p x) (pow (- x y) 2)))) < -5.68878655196326e-310

1. Initial program 2.8

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

$\leadsto \frac{x - y}{\color{blue}{\left(\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}\right) \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}}}$
4. Applied *-un-lft-identity4.0

$\leadsto \frac{\color{blue}{1 \cdot \left(x - y\right)}}{\left(\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}\right) \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}}$
5. Applied times-frac4.0

$\leadsto \color{blue}{\frac{1}{\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}} \cdot \sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}} \cdot \frac{x - y}{\sqrt[3]{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}}}$

## if -5.68878655196326e-310 < (/ (- x y) (sqrt (+ (* p x) (pow (- x y) 2)))) < 7.187370790730964e-272

1. Initial program 62.0

$\frac{x - y}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}$
2. Taylor expanded around 0 33.0

$\leadsto \frac{x - y}{\color{blue}{y - x}}$

## if 7.187370790730964e-272 < (/ (- x y) (sqrt (+ (* p x) (pow (- x y) 2))))

1. Initial program 11.7

$\frac{x - y}{\sqrt{p \cdot x + {\left(x - y\right)}^{2}}}$
2. Using strategy rm
3. Applied *-un-lft-identity11.7

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

$\leadsto \frac{x - y}{\color{blue}{\sqrt{1} \cdot \sqrt{p \cdot x + {\left(x - y\right)}^{2}}}}$

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

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

# Runtime

Time bar (total: 1.7m)Debug log

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