Average Error: 33.9 → 9.5
Time: 1.7m
Precision: 64
Internal Precision: 3392
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -1.570357730265518 \cdot 10^{+119}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{if}\;b_2 \le 7.047938000182739 \cdot 10^{-112}:\\ \;\;\;\;\frac{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right))_*}{a}\\ \mathbf{if}\;b_2 \le 4.963164276355321 \cdot 10^{-27}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) + (\left(\frac{c}{b_2}\right) \cdot \left(\frac{1}{2} \cdot a\right) + \left(-b_2\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.570357730265518e+119

    1. Initial program 48.7

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

      \[\leadsto \color{blue}{-2 \cdot \frac{b_2}{a}}\]

    if -1.570357730265518e+119 < b_2 < 7.047938000182739e-112

    1. Initial program 12.3

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt12.6

      \[\leadsto \frac{\color{blue}{\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \sqrt[3]{-b_2}} + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    4. Applied fma-def12.5

      \[\leadsto \frac{\color{blue}{(\left(\sqrt[3]{-b_2} \cdot \sqrt[3]{-b_2}\right) \cdot \left(\sqrt[3]{-b_2}\right) + \left(\sqrt{b_2 \cdot b_2 - a \cdot c}\right))_*}}{a}\]

    if 7.047938000182739e-112 < b_2 < 4.963164276355321e-27

    1. Initial program 31.8

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

      \[\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 simplify18.0

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

    if 4.963164276355321e-27 < b_2

    1. Initial program 54.8

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

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

      \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a}\]
    5. Taylor expanded around inf 17.1

      \[\leadsto \frac{\frac{c \cdot a}{\left(-b_2\right) - \color{blue}{\left(b_2 - \frac{1}{2} \cdot \frac{c \cdot a}{b_2}\right)}}}{a}\]
    6. Applied simplify6.3

      \[\leadsto \color{blue}{\frac{c}{\left(-b_2\right) + (\left(\frac{c}{b_2}\right) \cdot \left(\frac{1}{2} \cdot a\right) + \left(-b_2\right))_*}}\]
  3. Recombined 4 regimes into one program.

Runtime

Time bar (total: 1.7m)Debug logProfile

herbie shell --seed 2018206 +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))