Average Error: 34.1 → 9.6
Time: 23.2s
Precision: 64
Internal Precision: 128
\[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b_2 \le -4.8702760011024745 \cdot 10^{+113}:\\ \;\;\;\;\left(\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a}\right) - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.9379739650628456 \cdot 10^{-78}:\\ \;\;\;\;\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 2.5482541494853623 \cdot 10^{-62}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.387647669713383 \cdot 10^{-51}:\\ \;\;\;\;\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.378908863446963 \cdot 10^{-10}:\\ \;\;\;\;\frac{a \cdot \left(-c\right)}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{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 < -4.8702760011024745e+113

    1. Initial program 48.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification48.4

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied div-sub48.4

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

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

    if -4.8702760011024745e+113 < b_2 < 1.9379739650628456e-78 or 2.5482541494853623e-62 < b_2 < 2.387647669713383e-51

    1. Initial program 13.4

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification13.4

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied div-sub13.4

      \[\leadsto \color{blue}{\frac{\sqrt{b_2 \cdot b_2 - a \cdot c}}{a} - \frac{b_2}{a}}\]
    5. Using strategy rm
    6. Applied *-un-lft-identity13.4

      \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}}}{a} - \frac{b_2}{a}\]
    7. Applied associate-/l*13.5

      \[\leadsto \color{blue}{\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - a \cdot c}}}} - \frac{b_2}{a}\]
    8. Using strategy rm
    9. Applied associate-/r/13.5

      \[\leadsto \color{blue}{\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c}} - \frac{b_2}{a}\]

    if 1.9379739650628456e-78 < b_2 < 2.5482541494853623e-62 or 1.378908863446963e-10 < b_2

    1. Initial program 54.6

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification54.6

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Taylor expanded around inf 6.1

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

    if 2.387647669713383e-51 < b_2 < 1.378908863446963e-10

    1. Initial program 38.8

      \[\frac{\left(-b_2\right) + \sqrt{b_2 \cdot b_2 - a \cdot c}}{a}\]
    2. Initial simplification38.8

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied flip--38.9

      \[\leadsto \frac{\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}}}{a}\]
    5. Applied associate-/l/43.7

      \[\leadsto \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}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}}\]
    6. Simplified20.8

      \[\leadsto \frac{\color{blue}{-a \cdot c}}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification9.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -4.8702760011024745 \cdot 10^{+113}:\\ \;\;\;\;\left(\frac{1}{2} \cdot \frac{c}{b_2} - \frac{b_2}{a}\right) - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.9379739650628456 \cdot 10^{-78}:\\ \;\;\;\;\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 2.5482541494853623 \cdot 10^{-62}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \mathbf{elif}\;b_2 \le 2.387647669713383 \cdot 10^{-51}:\\ \;\;\;\;\frac{1}{a} \cdot \sqrt{b_2 \cdot b_2 - a \cdot c} - \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le 1.378908863446963 \cdot 10^{-10}:\\ \;\;\;\;\frac{a \cdot \left(-c\right)}{\left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right) \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b_2}\\ \end{array}\]

Runtime

Time bar (total: 23.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes34.89.65.629.186.4%
herbie shell --seed 2018354 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))