Average Error: 33.4 → 8.9
Time: 1.9m
Precision: 64
Internal Precision: 3456
\[\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b/2 \le -1.0015408820196246 \cdot 10^{+67}:\\ \;\;\;\;\frac{1}{2} \cdot \frac{c}{b/2} - 2 \cdot \frac{b/2}{a}\\ \mathbf{if}\;b/2 \le 5.905604736002757 \cdot 10^{-181}:\\ \;\;\;\;\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}\\ \mathbf{if}\;b/2 \le 5.667357913699899 \cdot 10^{+71}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(\left(-b/2\right) - b/2\right) + \frac{a}{b/2} \cdot \left(\frac{1}{2} \cdot c\right)}\\ \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.0015408820196246e+67

    1. Initial program 38.9

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

      \[\leadsto \color{blue}{\left(\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}\right) \cdot \frac{1}{a}}\]
    4. Taylor expanded around -inf 4.8

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

    if -1.0015408820196246e+67 < b/2 < 5.905604736002757e-181

    1. Initial program 11.2

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

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

    if 5.905604736002757e-181 < b/2 < 5.667357913699899e+71

    1. Initial program 35.9

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

      \[\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 simplify16.4

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

    if 5.667357913699899e+71 < b/2

    1. Initial program 57.1

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

      \[\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 simplify29.4

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b/2\right) - \sqrt{b/2 \cdot b/2 - a \cdot c}}}{a}\]
    5. Using strategy rm
    6. Applied add-exp-log30.3

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) - \color{blue}{e^{\log \left(\sqrt{b/2 \cdot b/2 - a \cdot c}\right)}}}}{a}\]
    7. Taylor expanded around inf 16.7

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b/2\right) - e^{\log \color{blue}{\left(b/2 - \frac{1}{2} \cdot \frac{c \cdot a}{b/2}\right)}}}}{a}\]
    8. Applied simplify3.0

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

Runtime

Time bar (total: 1.9m)Debug logProfile

herbie shell --seed '#(1063154770 1824007522 645063331 41291047 494775821 1237684644)' 
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))