Average Error: 19.5 → 9.1
Time: 34.8s
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 -1.3113335146564099 \cdot 10^{+63}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \le 1.7046387938297039 \cdot 10^{+69}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}} \cdot \sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\right) \cdot \sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}} \cdot \sqrt{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - 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 < -1.3113335146564099e+63

    1. Initial program 37.6

      \[\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. Initial simplification37.6

      \[\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{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - b}{2 \cdot a}\\ \end{array}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt37.7

      \[\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{\sqrt{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c}} - b}{2 \cdot a}\\ \end{array}\]
    5. Taylor expanded around -inf 10.7

      \[\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{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}\]

    if -1.3113335146564099e+63 < b < 1.7046387938297039e+69

    1. Initial program 9.6

      \[\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. Initial simplification9.6

      \[\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{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - b}{2 \cdot a}\\ \end{array}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt9.7

      \[\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{\sqrt{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c}} \cdot \sqrt{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c}} - b}{2 \cdot a}\\ \end{array}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt9.8

      \[\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{\sqrt{\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}}} \cdot \sqrt{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c}} - b}{2 \cdot a}\\ \end{array}\]

    if 1.7046387938297039e+69 < b

    1. Initial program 26.8

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

      \[\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{\sqrt{b \cdot b + \left(-4 \cdot a\right) \cdot c} - b}{2 \cdot a}\\ \end{array}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt26.9

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\color{blue}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot 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.
  4. Final simplification9.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.3113335146564099 \cdot 10^{+63}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \le 1.7046387938297039 \cdot 10^{+69}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) - \sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(\sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}} \cdot \sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}\right) \cdot \sqrt[3]{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}}} \cdot \sqrt{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b}} - b}{2 \cdot a}\\ \end{array}\\ \mathbf{elif}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot c}{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{\left(-4 \cdot a\right) \cdot c + b \cdot b} - b}{2 \cdot a}\\ \end{array}\]

Runtime

Time bar (total: 34.8s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes19.59.17.711.888.2%
herbie shell --seed 2018263 
(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))))