Average Error: 29.8 → 3.6
Time: 6.1s
Precision: 64
Internal Precision: 2368
\[b + \sqrt{\left(-b\right) \cdot \left(-b\right) - c}\]
\[\begin{array}{l} \mathbf{if}\;b \le -2.2869001147814792 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{b}\\ \mathbf{elif}\;b \le 4.412319935246271 \cdot 10^{+79}:\\ \;\;\;\;b + \sqrt{b \cdot b - c}\\ \mathbf{else}:\\ \;\;\;\;b \cdot 2 - \frac{c}{b} \cdot \frac{1}{2}\\ \end{array}\]

Error

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -2.2869001147814792e-45

    1. Initial program 52.7

      \[b + \sqrt{\left(-b\right) \cdot \left(-b\right) - c}\]
    2. Initial simplification52.7

      \[\leadsto b + \sqrt{b \cdot b - c}\]
    3. Taylor expanded around -inf 5.6

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{c}{b}}\]
    4. Using strategy rm
    5. Applied associate-*r/5.6

      \[\leadsto \color{blue}{\frac{\frac{1}{2} \cdot c}{b}}\]

    if -2.2869001147814792e-45 < b < 4.412319935246271e+79

    1. Initial program 3.0

      \[b + \sqrt{\left(-b\right) \cdot \left(-b\right) - c}\]
    2. Initial simplification3.0

      \[\leadsto b + \sqrt{b \cdot b - c}\]

    if 4.412319935246271e+79 < b

    1. Initial program 41.0

      \[b + \sqrt{\left(-b\right) \cdot \left(-b\right) - c}\]
    2. Initial simplification41.0

      \[\leadsto b + \sqrt{b \cdot b - c}\]
    3. Taylor expanded around inf 1.6

      \[\leadsto \color{blue}{2 \cdot b - \frac{1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.2869001147814792 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{1}{2} \cdot c}{b}\\ \mathbf{elif}\;b \le 4.412319935246271 \cdot 10^{+79}:\\ \;\;\;\;b + \sqrt{b \cdot b - c}\\ \mathbf{else}:\\ \;\;\;\;b \cdot 2 - \frac{c}{b} \cdot \frac{1}{2}\\ \end{array}\]

Runtime

Time bar (total: 6.1s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (b c)
  :name "b + sqrt((-b)*(-b) - c)"
  (+ b (sqrt (- (* (- b) (- b)) c))))