Average Error: 33.5 → 6.5
Time: 41.0s
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -3.996108540681055 \cdot 10^{+153}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le -2.437455455014579 \cdot 10^{-286}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 2.380499492041824 \cdot 10^{+64}:\\ \;\;\;\;\frac{\frac{c}{1}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b/2\right) - b/2\right) + \left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2}}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 4 regimes
  2. if b/2 < -3.996108540681055e+153

    1. Initial program 60.9

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 2.1

      \[\leadsto \color{blue}{-2 \cdot \frac{b/2}{a}}\]

    if -3.996108540681055e+153 < b/2 < -2.437455455014579e-286

    1. Initial program 8.6

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]

    if -2.437455455014579e-286 < b/2 < 2.380499492041824e+64

    1. Initial program 28.5

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+28.6

      \[\leadsto \frac{\color{blue}{\frac{\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
    4. Applied simplify15.9

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity15.9

      \[\leadsto \frac{\frac{c \cdot a}{\color{blue}{1 \cdot \left(\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}\right)}}}{a}\]
    7. Applied times-frac13.7

      \[\leadsto \frac{\color{blue}{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
    8. Applied associate-/l*9.4

      \[\leadsto \color{blue}{\frac{\frac{c}{1}}{\frac{a}{\frac{a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}}\]
    9. Applied simplify8.9

      \[\leadsto \frac{\frac{c}{1}}{\color{blue}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\]

    if 2.380499492041824e+64 < b/2

    1. Initial program 56.8

      \[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+56.8

      \[\leadsto \frac{\color{blue}{\frac{\left(-b/2\right) \cdot \left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}}{a}\]
    4. Applied simplify29.2

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Taylor expanded around inf 14.4

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) - \color{blue}{\left(b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}\right)}}}{a}\]
    6. Applied simplify3.3

      \[\leadsto \color{blue}{\frac{c}{\left(\left(-b/2\right) - b/2\right) + \left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2}}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 41.0s)Debug logProfile

herbie shell --seed '#(1064269945 2896236262 301053905 1701069080 1701464310 1614783279)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))