Average Error: 36.7 → 7.9
Time: 15.8s
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 -1.3062662437731836 \cdot 10^{+121}:\\ \;\;\;\;-2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 4.2035740698161473 \cdot 10^{-44}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\frac{1}{2} \cdot c\right) \cdot \frac{a}{b/2} + \left(\left(-b/2\right) - 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.3062662437731836e+121

    1. Initial program 51.4

      \[\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 -1.3062662437731836e+121 < b/2 < 4.2035740698161473e-44

    1. Initial program 13.9

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

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

    if 4.2035740698161473e-44 < b/2

    1. Initial program 58.5

      \[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip-+ 58.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 32.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 add-cube-cbrt 32.9

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

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) - {\left(\sqrt[3]{b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}}\right)}^3}}{a}\]
    8. Taylor expanded around inf 15.1

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

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

Runtime

Time bar (total: 15.8s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064524629 4159152179 2999149171 575749698 4006532819 692958815)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))