Average Error: 33.0 → 9.3
Time: 1.0m
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 -1.599868911955505 \cdot 10^{+89}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b/2} - \left(\frac{b/2}{a} + \frac{b/2}{a}\right)\\ \mathbf{if}\;b/2 \le 2.5778335136000024 \cdot 10^{-56}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{c \cdot \frac{1}{2}}{\frac{b/2}{a}} - \left(b/2 + b/2\right)}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b/2

Bits error versus c

Derivation

  1. Split input into 3 regimes
  2. if b/2 < -1.599868911955505e+89

    1. Initial program 42.3

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

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

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

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

    if -1.599868911955505e+89 < b/2 < 2.5778335136000024e-56

    1. Initial program 12.3

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

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

    if 2.5778335136000024e-56 < b/2

    1. Initial program 53.8

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

      \[\leadsto \color{blue}{\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Using strategy rm
    5. Applied flip-+53.9

      \[\leadsto \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}}} \cdot \frac{1}{a}\]
    6. Applied associate-*l/53.9

      \[\leadsto \color{blue}{\frac{\left(\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}\right) \cdot \frac{1}{a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}\]
    7. Applied simplify23.2

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

      \[\leadsto \frac{\frac{c \cdot a}{a}}{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - 2 \cdot b/2}}\]
    9. Applied simplify7.7

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

Runtime

Time bar (total: 1.0m)Debug logProfile

herbie shell --seed '#(1070355188 2193211668 3977393919 3454156579 3755371326 1656365382)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))