Average Error: 28.4 → 5.8
Time: 10.3s
Precision: binary64
Cost: 34432
\[1.0536712127723509 \cdot 10^{-08} < a \land a < 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} < b \land b < 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} < c \land c < 94906265.62425156\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\left(\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} \cdot -5\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\left(\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} \cdot -5
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (+
  (-
   (-
    (* -2.0 (/ (* c (* (* a a) (* c c))) (pow b 5.0)))
    (/ (* a (* c c)) (pow b 3.0)))
   (/ c b))
  (* (/ (* (pow c 4.0) (pow a 3.0)) (pow b 7.0)) -5.0)))
double code(double a, double b, double c) {
	return (-b + sqrt((b * b) - ((4.0 * a) * c))) / (2.0 * a);
}
double code(double a, double b, double c) {
	return (((-2.0 * ((c * ((a * a) * (c * c))) / pow(b, 5.0))) - ((a * (c * c)) / pow(b, 3.0))) - (c / b)) + (((pow(c, 4.0) * pow(a, 3.0)) / pow(b, 7.0)) * -5.0);
}

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

Alternatives

Alternative 1
Error7.0
Cost14849
\[\begin{array}{l} \mathbf{if}\;b \leq 11.560297428247756:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\\ \end{array}\]
Alternative 2
Error9.6
Cost8577
\[\begin{array}{l} \mathbf{if}\;b \leq 13.36790805006234:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 4\right)\right) - b \cdot b}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}}}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\\ \end{array}\]
Alternative 3
Error9.8
Cost7809
\[\begin{array}{l} \mathbf{if}\;b \leq 13.649810967366726:\\ \;\;\;\;\frac{1}{\frac{a}{\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\\ \end{array}\]
Alternative 4
Error9.8
Cost7681
\[\begin{array}{l} \mathbf{if}\;b \leq 13.36790805006234:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c}{b} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\\ \end{array}\]
Alternative 5
Error11.9
Cost7232
\[\frac{-c}{b} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\]
Alternative 6
Error22.9
Cost256
\[\frac{-c}{b}\]
Alternative 7
Error55.6
Cost64
\[-1\]
Alternative 8
Error62.0
Cost64
\[0\]
Alternative 9
Error63.0
Cost64
\[1\]

Error

Derivation

  1. Initial program 28.4

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

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

    \[\leadsto \color{blue}{-\left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} + \left(\frac{c}{b} + \left(\frac{a \cdot {c}^{2}}{{b}^{3}} + 2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{5}}\right)\right)\right)}\]
  4. Simplified5.8

    \[\leadsto \color{blue}{\left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot {c}^{3}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5}\]
  5. Using strategy rm
  6. Applied unpow3_binary64_4855.8

    \[\leadsto \left(\left(-2 \cdot \frac{\left(a \cdot a\right) \cdot \color{blue}{\left(\left(c \cdot c\right) \cdot c\right)}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5\]
  7. Applied associate-*r*_binary64_3595.8

    \[\leadsto \left(\left(-2 \cdot \frac{\color{blue}{\left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right) \cdot c}}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{a}^{3} \cdot {c}^{4}}{{b}^{7}} \cdot -5\]
  8. Simplified5.8

    \[\leadsto \color{blue}{\left(\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} \cdot -5}\]
  9. Final simplification5.8

    \[\leadsto \left(\left(-2 \cdot \frac{c \cdot \left(\left(a \cdot a\right) \cdot \left(c \cdot c\right)\right)}{{b}^{5}} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\right) - \frac{c}{b}\right) + \frac{{c}^{4} \cdot {a}^{3}}{{b}^{7}} \cdot -5\]

Reproduce

herbie shell --seed 2021044 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))