Average Error: 31.8 → 15.8
Time: 1.6m
Precision: 64
Internal Precision: 320
$\frac{x - y}{\sqrt{px + {\left(x - y\right)}^{2}}}$
$\begin{array}{l} \mathbf{if}\;x - y \le -5.77126452019715 \cdot 10^{+140}:\\ \;\;\;\;\frac{x - y}{y - x}\\ \mathbf{else}:\\ \;\;\;\;\left(x - y\right) \cdot \frac{1}{\sqrt{px + {\left(x - 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 (- x y) < -5.77126452019715e+140

1. Initial program 57.8

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

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

## if -5.77126452019715e+140 < (- x y)

1. Initial program 21.8

$\frac{x - y}{\sqrt{px + {\left(x - y\right)}^{2}}}$
2. Using strategy rm
3. Applied div-inv21.9

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

# Runtime

Time bar (total: 1.6m)Debug log

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