sqrt_discriminant = math.sqrt(b*b - 4*a*c)
ta = (-b - sqrt_discriminant) / (2*a)
tb = (-b + sqrt_discriminant) / (2*a)
return ta, tb
def solve(self, trust_radius):
raise NotImplementedError("The solve method should be implemented by "
"the child class")
After Change
// but produce smaller round off errors.
// Look at Matrix Computation p.97
// for a better justification.
aux = b + math.copysign(sqrt_discriminant, b)
ta = -aux / (2*a)
tb = -2*c / aux
return sorted([ta, tb])
def solve(self, trust_radius):
raise NotImplementedError("The solve method should be implemented by "
"the child class")