Average Error: 33.2 → 9.1
Time: 1.4m
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 -8.917215315272224 \cdot 10^{+27}:\\ \;\;\;\;\frac{c}{b/2} \cdot \frac{1}{2} - \frac{b/2}{a} \cdot 2\\ \mathbf{if}\;b/2 \le 2.7753668003366157 \cdot 10^{-192}:\\ \;\;\;\;\frac{\left(-b/2\right) + \sqrt{b/2 \cdot b/2 - a \cdot c}}{a}\\ \mathbf{if}\;b/2 \le 3.153924085667979 \cdot 10^{+60}:\\ \;\;\;\;\frac{1}{\frac{a}{\frac{\left(-a\right) \cdot c}{\sqrt{b/2 \cdot b/2 - a \cdot c} + b/2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\frac{b/2}{\frac{-1}{2}}}\\ \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 < -8.917215315272224e+27

    1. Initial program 31.9

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

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

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

    if -8.917215315272224e+27 < b/2 < 2.7753668003366157e-192

    1. Initial program 10.7

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

    if 2.7753668003366157e-192 < b/2 < 3.153924085667979e+60

    1. Initial program 35.1

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

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

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\sqrt{b/2 \cdot b/2 - a \cdot c} - b/2}}}\]
    5. Using strategy rm
    6. Applied flip--35.2

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\frac{\sqrt{b/2 \cdot b/2 - a \cdot c} \cdot \sqrt{b/2 \cdot b/2 - a \cdot c} - b/2 \cdot b/2}{\sqrt{b/2 \cdot b/2 - a \cdot c} + b/2}}}}\]
    7. Applied simplify16.7

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

    if 3.153924085667979e+60 < b/2

    1. Initial program 56.3

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

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

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

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed '#(1070960995 739739648 2531964651 3069671617 351857262 3877178482)' +o rules:numerics
(FPCore (a b/2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b/2) (sqrt (- (* b/2 b/2) (* a c)))) a))