Average Error: 36.2 → 5.8
Time: 1.4m
Precision: 64
Internal Precision: 3200
\[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -1.5109696884710251 \cdot 10^{+32}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le -5.265216833412822 \cdot 10^{-50}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\\ \mathbf{if}\;b/2 \le -5.313823226269673 \cdot 10^{-107}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{-1}{2}\\ \mathbf{if}\;b/2 \le 1.6622135411792587 \cdot 10^{+81}:\\ \;\;\;\;\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/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 4 regimes
  2. if b/2 < -1.5109696884710251e+32 or -5.265216833412822e-50 < b/2 < -5.313823226269673e-107

    1. Initial program 58.3

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 14.8

      \[\leadsto \frac{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b/2}}}{a}\]
    3. Applied simplify0.0

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

    if -1.5109696884710251e+32 < b/2 < -5.265216833412822e-50

    1. Initial program 41.2

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

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

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

    if -5.313823226269673e-107 < b/2 < 1.6622135411792587e+81

    1. Initial program 12.1

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

    if 1.6622135411792587e+81 < b/2

    1. Initial program 43.1

      \[\frac{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
    2. Taylor expanded around inf 0

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

Runtime

Time bar (total: 1.4m)Debug log

herbie shell --seed '#(1567391828 2030694642 2833800258 828025724 3004380912 3532991858)' +o setup:early-exit +o reduce:binary-search
(FPCore (a b/2 c)
  :name "quad2m (problem 3.2.1, negative)"
  (/ (- (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))