Average Error: 33.3 → 7.5
Time: 27.2s
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 -8.318102466069036 \cdot 10^{+150}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -2.470005776589605 \cdot 10^{-265}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 7.059918297193474 \cdot 10^{+111}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b_2 + \left(b_2 - \frac{c \cdot a}{b_2} \cdot \frac{1}{2}\right)}\\ \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 < -8.318102466069036e+150

    1. Initial program 59.6

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

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

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

    if -8.318102466069036e+150 < b_2 < -2.470005776589605e-265

    1. Initial program 7.8

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

      \[\leadsto \frac{\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2}{a}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity7.8

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} - b_2\right)}}{a}\]
    5. Applied associate-/l*8.0

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

    if -2.470005776589605e-265 < b_2 < 7.059918297193474e+111

    1. Initial program 31.5

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

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

      \[\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/35.9

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

      \[\leadsto \frac{\color{blue}{-a \cdot c}}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    7. Using strategy rm
    8. Applied distribute-frac-neg20.4

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

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

    if 7.059918297193474e+111 < b_2

    1. Initial program 59.4

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

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

      \[\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/59.6

      \[\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. Simplified33.8

      \[\leadsto \frac{\color{blue}{-a \cdot c}}{a \cdot \left(\sqrt{b_2 \cdot b_2 - a \cdot c} + b_2\right)}\]
    7. Using strategy rm
    8. Applied distribute-frac-neg33.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b_2 \le -8.318102466069036 \cdot 10^{+150}:\\ \;\;\;\;-2 \cdot \frac{b_2}{a}\\ \mathbf{elif}\;b_2 \le -2.470005776589605 \cdot 10^{-265}:\\ \;\;\;\;\frac{1}{\frac{a}{\sqrt{b_2 \cdot b_2 - c \cdot a} - b_2}}\\ \mathbf{elif}\;b_2 \le 7.059918297193474 \cdot 10^{+111}:\\ \;\;\;\;\frac{-c}{\sqrt{b_2 \cdot b_2 - c \cdot a} + b_2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b_2 + \left(b_2 - \frac{c \cdot a}{b_2} \cdot \frac{1}{2}\right)}\\ \end{array}\]

Runtime

Time bar (total: 27.2s)Debug logProfile

herbie shell --seed 2018249 
(FPCore (a b_2 c)
  :name "quad2p (problem 3.2.1, positive)"
  (/ (+ (- b_2) (sqrt (- (* b_2 b_2) (* a c)))) a))