Average Error: 20.0 → 7.4
Time: 1.4m
Precision: 64
Internal Precision: 576
\[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;b \le -3.3298569804456744 \cdot 10^{+102}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{-1} - b}{a \cdot 2}\\ \end{array}\\ \mathbf{if}\;b \le 6.91130196611575 \cdot 10^{+143}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\left|{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right)}^{\frac{1}{3}}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\\ \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{c}{c \cdot \frac{a}{b} - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a}\\ \end{array}\]

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if b < -3.3298569804456744e+102

    1. Initial program 45.9

      \[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
    2. Using strategy rm
    3. Applied add-exp-log47.1

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + e^{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\\ \end{array}\]
    4. Taylor expanded around -inf 3.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\frac{-1}{b}\right)}^{-1} - b}{2 \cdot a}\\ \end{array}\]
    5. Applied simplify3.4

      \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b}{-1} - b}{a \cdot 2}\\ \end{array}}\]

    if -3.3298569804456744e+102 < b < 6.91130196611575e+143

    1. Initial program 8.9

      \[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
    2. Using strategy rm
    3. Applied add-exp-log10.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + e^{\log \left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}{2 \cdot a}\\ \end{array}\]
    4. Using strategy rm
    5. Applied add-cube-cbrt10.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + e^{\log \left(\left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}}{2 \cdot a}\\ \end{array}\]
    6. Applied log-prod10.5

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + e^{\log \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right) + \log \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}}{2 \cdot a}\\ \end{array}\]
    7. Applied exp-sum10.4

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + e^{\log \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)} \cdot e^{\log \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}}{2 \cdot a}\\ \end{array}\]
    8. Applied simplify9.9

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}}\right) \cdot e^{\log \left(\sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\right)}}{2 \cdot a}\\ \end{array}\]
    9. Applied simplify9.3

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt9.2

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\sqrt{\left(\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4} \cdot \sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}\right) \cdot \sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\]
    12. Applied sqrt-prod9.2

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\sqrt{\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4} \cdot \sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt{\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\]
    13. Applied simplify9.2

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\left|\sqrt[3]{b \cdot b - \left(a \cdot 4\right) \cdot c}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\]
    14. Using strategy rm
    15. Applied pow1/39.9

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{b \cdot b - \left(a \cdot c\right) \cdot 4}} \cdot \sqrt[3]{\left|{\left(b \cdot b - \left(a \cdot 4\right) \cdot c\right)}^{\frac{1}{3}}\right| \cdot \sqrt{\sqrt[3]{b \cdot b - \left(a \cdot c\right) \cdot 4}}}\right) \cdot \sqrt[3]{\sqrt{b \cdot b - \left(4 \cdot c\right) \cdot a}}}{2 \cdot a}\\ \end{array}\]

    if 6.91130196611575e+143 < b

    1. Initial program 37.0

      \[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
    2. Taylor expanded around inf 6.7

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \frac{c \cdot a}{b} - 2 \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \end{array}\]
    3. Applied simplify2.2

      \[\leadsto \color{blue}{\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{c}{c \cdot \frac{a}{b} - b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a}\\ \end{array}}\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 1.4m)Debug logProfile

herbie shell --seed 2018195 
(FPCore (a b c)
  :name "jeff quadratic root 2"
  (if (>= b 0) (/ (* 2 c) (- (- b) (sqrt (- (* b b) (* (* 4 a) c))))) (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a))))