I want to calculate this second degree equation in python:
10^-6x^2 +10x + 10^-6 = 0
Using the known formula it would look like this in python:
#This is just a small part of the program#
a = 10.**-6
b = 10.
c = 10.**-6
square = sqrt((b**2) - (4.*a*c))
numerator1 = -b - square
numerator2 = -b + square
denominator = 2.*a
print square
print numerator1
print numerator2
Now to my question: Round off errors makes my
square = 10.0
numerator1 = -20
numerator2 = -1.98951966013e-13
Why is my second numerator so way off? -b is the same in both cases... This will make my x2 be calculated in the wrong way. How can I fix this round off error?