Average Error: 43.8 → 0.3
Time: 2.3min
Precision: binary64
Cost: 27584
\[1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992 \land 1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot e^{2 \cdot \log \left(a \cdot c\right)}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot e^{2 \cdot \log \left(a \cdot c\right)}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (/
  (*
   (* a 2.0)
   (/
    c
    (-
     (- b)
     (sqrt
      (/
       (+ (pow b 4.0) (* -16.0 (exp (* 2.0 (log (* a c))))))
       (+ (* b b) (* c (* a 4.0))))))))
  a))
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 ((a * 2.0) * (c / (-b - sqrt((pow(b, 4.0) + (-16.0 * exp(2.0 * log(a * c)))) / ((b * b) + (c * (a * 4.0))))))) / a;
}

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
Error0.2
Cost7616
\[\frac{\frac{c}{b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}} \cdot \left(a \cdot -2\right)}{a}\]
Alternative 2
Error0.4
Cost7488
\[\frac{1}{\left(b + \sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)}\right) \cdot \frac{-0.5}{c}}\]
Alternative 3
Error5.7
Cost7232
\[\frac{-c}{b} - \frac{a \cdot \left(c \cdot c\right)}{{b}^{3}}\]
Alternative 4
Error5.7
Cost1216
\[\frac{\frac{c \cdot \left(a \cdot 4\right)}{2 \cdot \left(\frac{a \cdot c}{b} - b\right)}}{a \cdot 2}\]
Alternative 5
Error12.0
Cost256
\[\frac{-c}{b}\]
Alternative 6
Error56.6
Cost64
\[-1\]

Error

Derivation

  1. Initial program 43.8

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
  2. Using strategy rm
  3. Applied flip-+_binary64_107543.9

    \[\leadsto \frac{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}{2 \cdot a}\]
  4. Simplified0.4

    \[\leadsto \frac{\frac{\color{blue}{\left(4 \cdot a\right) \cdot c}}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\]
  5. Using strategy rm
  6. Applied associate-/r*_binary64_10450.4

    \[\leadsto \color{blue}{\frac{\frac{\frac{\left(4 \cdot a\right) \cdot c}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}{2}}{a}}\]
  7. Simplified0.2

    \[\leadsto \frac{\color{blue}{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{b \cdot b - c \cdot \left(4 \cdot a\right)}}}}{a}\]
  8. Using strategy rm
  9. Applied flip--_binary64_10760.2

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\color{blue}{\frac{\left(b \cdot b\right) \cdot \left(b \cdot b\right) - \left(c \cdot \left(4 \cdot a\right)\right) \cdot \left(c \cdot \left(4 \cdot a\right)\right)}{b \cdot b + c \cdot \left(4 \cdot a\right)}}}}}{a}\]
  10. Simplified0.2

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{\color{blue}{{b}^{4} + -16 \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)}}{b \cdot b + c \cdot \left(4 \cdot a\right)}}}}{a}\]
  11. Simplified0.2

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot a\right)\right)}{\color{blue}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}}{a}\]
  12. Using strategy rm
  13. Applied add-exp-log_binary64_11390.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(c \cdot c\right) \cdot \left(a \cdot \color{blue}{e^{\log a}}\right)\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  14. Applied add-exp-log_binary64_11390.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(c \cdot c\right) \cdot \left(\color{blue}{e^{\log a}} \cdot e^{\log a}\right)\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  15. Applied prod-exp_binary64_11500.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(c \cdot c\right) \cdot \color{blue}{e^{\log a + \log a}}\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  16. Applied add-exp-log_binary64_11390.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(c \cdot \color{blue}{e^{\log c}}\right) \cdot e^{\log a + \log a}\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  17. Applied add-exp-log_binary64_11390.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\left(\color{blue}{e^{\log c}} \cdot e^{\log c}\right) \cdot e^{\log a + \log a}\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  18. Applied prod-exp_binary64_11500.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \left(\color{blue}{e^{\log c + \log c}} \cdot e^{\log a + \log a}\right)}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  19. Applied prod-exp_binary64_11500.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot \color{blue}{e^{\left(\log c + \log c\right) + \left(\log a + \log a\right)}}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  20. Simplified0.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot e^{\color{blue}{2 \cdot \log \left(c \cdot a\right)}}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]
  21. Simplified0.3

    \[\leadsto \color{blue}{\frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot e^{2 \cdot \log \left(c \cdot a\right)}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}}\]
  22. Final simplification0.3

    \[\leadsto \frac{\left(a \cdot 2\right) \cdot \frac{c}{\left(-b\right) - \sqrt{\frac{{b}^{4} + -16 \cdot e^{2 \cdot \log \left(a \cdot c\right)}}{b \cdot b + c \cdot \left(a \cdot 4\right)}}}}{a}\]

Reproduce

herbie shell --seed 2021014 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :precision binary64
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))