Average Error: 33.2 → 9.1
Time: 1.2m
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{\frac{1}{2} \cdot c}{b/2} - \left(\frac{b/2}{a} + \frac{b/2}{a}\right)\\ \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{c \cdot \left(-a\right)}{\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{\left(-b/2\right) + \color{blue}{\left(\frac{1}{2} \cdot \frac{c \cdot a}{b/2} - b/2\right)}}{a}\]
    3. Applied simplify6.8

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

    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}{c \cdot \left(-a\right)}}{\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.2m)Debug logProfile

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