Reputation: 11
While finding roots of a quadratic equation, subtractive cancellation is an issue when b^2 is much greater than 4ac. So, I need to first check whether the given equation has this issue or not. Then if there's an issue, I need to find an alternative way which is to calculate r=-(b+sign(b)*sqrt(delta)) and then we get the roots 2c/r and r/2a. I am struck at checking b^2 is much greater than 4ac.
Upvotes: 1
Views: 83
Reputation: 36710
Solutions are:
roots
, which deals with this issue very well.Upvotes: 1