Average Error: 38.7 → 4.1
Time: 11.4s
Precision: 64
Internal precision: 2688
\[\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -7.775815916098481 \cdot 10^{-103}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 2.4861451900721143 \cdot 10^{+28}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{{b/2}^2 - a \cdot c}}{a}\\ \mathbf{else}:\\ \;\;\;\;-2 \cdot \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 3 regimes.
  2. if b/2 < -7.775815916098481e-103

    1. Initial program 58.5

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

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

      \[\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}}\]

    if -7.775815916098481e-103 < b/2 < 2.4861451900721143e+28

    1. Initial program 12.4

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

    if 2.4861451900721143e+28 < b/2

    1. Initial program 39.1

      \[\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}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Time bar (total: 11.4s) Debug logProfile

Please include this information when filing a bug report:

herbie shell --seed '#(1064651971 495577305 2200811460 13024471 864198081 231948279)'
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (sqr b/2) (* a c)))) a))