Average Error: 33.2 → 9.8
Time: 1.8m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -2.670439130598377 \cdot 10^{+115}:\\ \;\;\;\;\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2\\ \mathbf{if}\;b_2 \le 2.6278101242822053 \cdot 10^{-54}:\\ \;\;\;\;\frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

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 < -2.670439130598377e+115

    1. Initial program 47.5

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

      \[\leadsto \frac{\color{blue}{\frac{1}{2} \cdot \frac{c \cdot a}{b_2} - 2 \cdot b_2}}{a}\]
    3. Applied simplify3.1

      \[\leadsto \color{blue}{\frac{c}{b_2} \cdot \frac{1}{2} - \frac{b_2}{a} \cdot 2}\]

    if -2.670439130598377e+115 < b_2 < 2.6278101242822053e-54

    1. Initial program 13.0

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt13.4

      \[\leadsto \frac{\color{blue}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}} \cdot \sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}{a}\]
    4. Applied associate-/l*13.4

      \[\leadsto \color{blue}{\frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\frac{a}{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}}\]
    5. Applied simplify13.4

      \[\leadsto \frac{\sqrt{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}{\color{blue}{\frac{a}{\sqrt{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}}\]

    if 2.6278101242822053e-54 < b_2

    1. Initial program 53.0

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

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}}{a}\]
    3. Applied simplify7.8

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b_2}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.8m)Debug logProfile

herbie shell --seed 2018199 +o rules:numerics
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))