Is there a way to compute sqrt(b^2 - 4ac) without losing precision? I think the bad case is when b^2 and 4ac are both large but the difference is small.
If they were integers, modular arithmetic might work. Correspondingly, the (standard) trick would be implement double-precision using single precision floats. (Or quad with double, etc.)
(b+2a)(b-2c) - 2b(a-c)
No comments :
Post a Comment