Average Error: 7.3 → 1.9
Time: 27.3s
Precision: 64
Internal Precision: 576
\[\frac{l_count \cdot l_mean + r_count \cdot r_mean}{n_count}\]
\[\begin{array}{l} \mathbf{if}\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count} \le -1.1838629653088484 \cdot 10^{+303}:\\ \;\;\;\;\frac{l_mean \cdot l_count}{n_count} + \frac{r_mean}{\frac{n_count}{r_count}}\\ \mathbf{if}\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count} \le -9.822413602453688 \cdot 10^{-154}:\\ \;\;\;\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count}\\ \mathbf{if}\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count} \le 3.437341463273333 \cdot 10^{+30}:\\ \;\;\;\;\left(l_count \cdot l_mean + r_count \cdot r_mean\right) \cdot \frac{1}{n_count}\\ \mathbf{if}\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count} \le 1.3778427102684655 \cdot 10^{+290}:\\ \;\;\;\;\frac{l_mean}{\frac{n_count}{l_count}} + \frac{r_mean \cdot r_count}{n_count}\\ \mathbf{else}:\\ \;\;\;\;\frac{l_mean \cdot l_count}{n_count} + \frac{r_mean}{\frac{n_count}{r_count}}\\ \end{array}\]

Error

Bits error versus l_count

Bits error versus l_mean

Bits error versus r_count

Bits error versus r_mean

Bits error versus n_count

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (+ (/ l_mean (/ n_count l_count)) (/ (* r_mean r_count) n_count)) < -1.1838629653088484e+303 or 1.3778427102684655e+290 < (+ (/ l_mean (/ n_count l_count)) (/ (* r_mean r_count) n_count))

    1. Initial program 35.2

      \[\frac{l_count \cdot l_mean + r_count \cdot r_mean}{n_count}\]
    2. Taylor expanded around 0 35.2

      \[\leadsto \color{blue}{\frac{l_mean \cdot l_count}{n_count} + \frac{r_mean \cdot r_count}{n_count}}\]
    3. Using strategy rm
    4. Applied associate-/l*9.0

      \[\leadsto \frac{l_mean \cdot l_count}{n_count} + \color{blue}{\frac{r_mean}{\frac{n_count}{r_count}}}\]

    if -1.1838629653088484e+303 < (+ (/ l_mean (/ n_count l_count)) (/ (* r_mean r_count) n_count)) < -9.822413602453688e-154 or 3.437341463273333e+30 < (+ (/ l_mean (/ n_count l_count)) (/ (* r_mean r_count) n_count)) < 1.3778427102684655e+290

    1. Initial program 5.6

      \[\frac{l_count \cdot l_mean + r_count \cdot r_mean}{n_count}\]
    2. Taylor expanded around 0 5.6

      \[\leadsto \color{blue}{\frac{l_mean \cdot l_count}{n_count} + \frac{r_mean \cdot r_count}{n_count}}\]
    3. Using strategy rm
    4. Applied associate-/l*0.6

      \[\leadsto \color{blue}{\frac{l_mean}{\frac{n_count}{l_count}}} + \frac{r_mean \cdot r_count}{n_count}\]

    if -9.822413602453688e-154 < (+ (/ l_mean (/ n_count l_count)) (/ (* r_mean r_count) n_count)) < 3.437341463273333e+30

    1. Initial program 1.8

      \[\frac{l_count \cdot l_mean + r_count \cdot r_mean}{n_count}\]
    2. Using strategy rm
    3. Applied div-inv1.9

      \[\leadsto \color{blue}{\left(l_count \cdot l_mean + r_count \cdot r_mean\right) \cdot \frac{1}{n_count}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 27.3s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (l_count l_mean r_count r_mean n_count)
  :name "(l_count * l_mean + r_count * r_mean) / n_count"
  (/ (+ (* l_count l_mean) (* r_count r_mean)) n_count))