Average Error: 33.1 → 7.7
Time: 1.6m
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 -2.1406405348732634 \cdot 10^{+100}:\\ \;\;\;\;c \cdot \frac{\frac{1}{2}}{b_2} - \left(\frac{b_2}{a} + \frac{b_2}{a}\right)\\ \mathbf{if}\;b_2 \le -6.679383503618167 \cdot 10^{-119}:\\ \;\;\;\;\frac{\left(-b_2\right) + \sqrt[3]{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \left(b_2 \cdot b_2 - a \cdot c\right)}}{a}\\ \mathbf{if}\;b_2 \le 2.817640349725426 \cdot 10^{+123}:\\ \;\;\;\;\frac{c}{\left(-b_2\right) - \sqrt{b_2 \cdot b_2 - c \cdot a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot c}{b_2}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b_2

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b_2 < -2.1406405348732634e+100

    1. Initial program 45.1

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

      \[\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 simplify3.3

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

    if -2.1406405348732634e+100 < b_2 < -6.679383503618167e-119

    1. Initial program 5.6

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

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

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

    if -6.679383503618167e-119 < b_2 < 2.817640349725426e+123

    1. Initial program 27.5

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Applied simplify27.6

      \[\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--28.8

      \[\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 associate-/r/28.8

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - b_2 \cdot b_2} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}}\]
    8. Applied simplify15.6

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{c \cdot \left(-a\right)}} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    9. Taylor expanded around 0 11.1

      \[\leadsto \frac{1}{\color{blue}{\frac{-1}{c}} \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    10. Applied simplify10.6

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

    if 2.817640349725426e+123 < b_2

    1. Initial program 59.9

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

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}}}\]
    4. Applied simplify59.9

      \[\leadsto \frac{1}{\color{blue}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}}}\]
    5. Taylor expanded around inf 14.4

      \[\leadsto \frac{1}{\frac{a}{\color{blue}{\frac{-1}{2} \cdot \frac{c \cdot a}{b_2}}}}\]
    6. Applied simplify1.9

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

Runtime

Time bar (total: 1.6m)Debug logProfile

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