Average Error: 19.5 → 7.6
Time: 31.6s
Precision: 64
Internal Precision: 128
\[\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot c}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \end{array}\]
\[\begin{array}{l} \mathbf{if}\;b \le -8.814041490544024 \cdot 10^{+132}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2}{\sqrt[3]{\frac{a}{b} \cdot \left(c \cdot 2\right) - \left(b + b\right)} \cdot \sqrt[3]{\frac{a}{b} \cdot \left(c \cdot 2\right) - \left(b + b\right)}} \cdot \frac{c}{\sqrt[3]{\frac{c}{b} \cdot \left(2 \cdot a\right) - \left(b + b\right)}}\\ \end{array}\\ \mathbf{elif}\;b \le 1.238956767312235 \cdot 10^{+131}:\\ \;\;\;\;\begin{array}{l} \mathbf{if}\;b \ge 0:\\ \;\;\;\;\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)} \cdot \sqrt{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}\\ \end{array}\\ \mathbf{elif}\;b \ge 0:\\ \;\;\;\;\frac{2 \cdot \frac{a \cdot c}{b} - 2 \cdot b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot 2}{\left(-b\right) + \left(2 \cdot \frac{a \cdot c}{b} - b\right)}\\ \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 < -8.814041490544024e+132

    1. Initial program 34.7

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

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

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

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

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

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

    if -8.814041490544024e+132 < b < 1.238956767312235e+131

    1. Initial program 8.3

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

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

    if 1.238956767312235e+131 < b

    1. Initial program 53.2

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

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

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

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

Runtime

Time bar (total: 31.6s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes21.67.66.215.490.7%
herbie shell --seed 2018353 
(FPCore (a b c)
  :name "jeff quadratic root 1"
  (if (>= b 0) (/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)) (/ (* 2 c) (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))))))