Average Error: 38.5 → 4.8
Time: 9.8s
Precision: 64
Internal precision: 2432
\[\frac{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -9.26777223902318 \cdot 10^{+150}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} - \frac{b/2 + b/2}{a}\\ \mathbf{if}\;b/2 \le 3.8012790836766795 \cdot 10^{-128}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b/2\right) + \sqrt{{b/2}^2 - a \cdot c}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \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 < -9.26777223902318e+150

    1. Initial program 59.4

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

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

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

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

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

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

    if -9.26777223902318e+150 < b/2 < 3.8012790836766795e-128

    1. Initial program 11.0

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

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

    if 3.8012790836766795e-128 < b/2

    1. Initial program 58.9

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

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

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    4. Applied simplify 0.0

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

Runtime

Time bar (total: 9.8s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1067615470 1817955187 3564058462 2385304812 1026693554 2746013648)'
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))