Average Error: 35.4 → 6.6
Time: 30.9s
Precision: 64
Internal precision: 2944
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -2.8335922143007058 \cdot 10^{+135}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 6.629433900186177 \cdot 10^{-280}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 2.4971715086460685 \cdot 10^{-08}:\\ \;\;\;\;\frac{\frac{c}{1} \cdot \frac{a}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b/2\right) - b/2\right) + \frac{\frac{1}{2} \cdot c}{\frac{b/2}{a}}}\\ \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 < -2.8335922143007058e+135

    1. Initial program 54.7

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Applied taylor 0

      \[\leadsto -2 \cdot \frac{b/2}{a}\]
    3. Taylor expanded around -inf 0

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

    if -2.8335922143007058e+135 < b/2 < 6.629433900186177e-280

    1. Initial program 9.0

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

    if 6.629433900186177e-280 < b/2 < 2.4971715086460685e-08

    1. Initial program 26.3

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

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

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

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

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

    if 2.4971715086460685e-08 < b/2

    1. Initial program 58.3

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}}{a}\]
    5. Applied taylor 15.6

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) - \left(b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}\right)}}{a}\]
    6. Taylor expanded around inf 15.6

      \[\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}\]
    7. Applied simplify 2.9

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

Runtime

Time bar (total: 30.9s) Debug log

Please include this information when filing a bug report:

herbie shell --seed '#(644180380 3784176976 401987740 22459203 1940947670 3323606534)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))