Average Error: 17.4 → 1.1
Time: 25.8s
Precision: 64
Internal Precision: 576
\[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\]
\[\begin{array}{l} \mathbf{if}\;b \le -4.2739777664688455 \cdot 10^{+115}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \frac{-1}{2} - b\\ \mathbf{elif}\;b \le 1.2311328369337278 \cdot 10^{+140}:\\ \;\;\;\;\left(-b\right) + a \cdot \frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \frac{1}{2} - b\\ \end{array}\]

Error

Bits error versus b

Bits error versus a

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 < -4.2739777664688455e+115

    1. Initial program 47.5

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

      \[\leadsto \frac{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{\frac{2}{a}} - b\]
    3. Taylor expanded around -inf 0.4

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

    if -4.2739777664688455e+115 < b < 1.2311328369337278e+140

    1. Initial program 1.5

      \[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\]

    if 1.2311328369337278e+140 < b

    1. Initial program 56.1

      \[\left(-b\right) + \frac{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\]
    2. Taylor expanded around inf 0.4

      \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(a \cdot b\right) - b}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.2739777664688455 \cdot 10^{+115}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \frac{-1}{2} - b\\ \mathbf{elif}\;b \le 1.2311328369337278 \cdot 10^{+140}:\\ \;\;\;\;\left(-b\right) + a \cdot \frac{\sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot a\right) \cdot \frac{1}{2} - b\\ \end{array}\]

Runtime

Time bar (total: 25.8s)Debug log

herbie shell --seed '#(2775764126 3555076145 3898259844 1891440260 2599947619 1948460636)' 
(FPCore (b a c)
  :name "-b + sqrt(b*b - (4*a*c))/2*a"
  (+ (- b) (* (/ (sqrt (- (* b b) (* (* 4 a) c))) 2) a)))