Average Error: 15.1 → 12.7
Time: 17.7s
Precision: 64
Internal Precision: 576
$\frac{x \cdot s1 + y \cdot s2}{s1 + s2}$
$\begin{array}{l} \mathbf{if}\;s2 \le -1.2666444378365085 \cdot 10^{+187} \lor \neg \left(s2 \le 1.1167839647039542 \cdot 10^{+210}\right):\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s1 + s2} \cdot \left(y \cdot s2 + x \cdot s1\right)\\ \end{array}$

# Try it out

Results

 In Out
Enter valid numbers for all inputs

# Derivation

1. Split input into 2 regimes
2. ## if s2 < -1.2666444378365085e+187 or 1.1167839647039542e+210 < s2

1. Initial program 29.1

$\frac{x \cdot s1 + y \cdot s2}{s1 + s2}$
2. Taylor expanded around 0 15.1

$\leadsto \color{blue}{y}$

## if -1.2666444378365085e+187 < s2 < 1.1167839647039542e+210

1. Initial program 12.0

$\frac{x \cdot s1 + y \cdot s2}{s1 + s2}$
2. Using strategy rm
3. Applied div-inv12.1

$\leadsto \color{blue}{\left(x \cdot s1 + y \cdot s2\right) \cdot \frac{1}{s1 + s2}}$
3. Recombined 2 regimes into one program.
4. Final simplification12.7

$\leadsto \begin{array}{l} \mathbf{if}\;s2 \le -1.2666444378365085 \cdot 10^{+187} \lor \neg \left(s2 \le 1.1167839647039542 \cdot 10^{+210}\right):\\ \;\;\;\;y\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{s1 + s2} \cdot \left(y \cdot s2 + x \cdot s1\right)\\ \end{array}$

# Runtime

Time bar (total: 17.7s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)'
(FPCore (x s1 y s2)
:name "(x*s1 + y*s2)/(s1 + s2)"
(/ (+ (* x s1) (* y s2)) (+ s1 s2)))