function [x1,x2]=bquad_solver(a,b,c)

% Function solves quadratic equation 
% ax^2+bx+c=0
% using textbook formulae (which are BAD for numerics due to possible
% catastrophic cancellation erros when subtracting two FP numbers) 

d=sqrt(b^2-4*a*c);
x1=(-b+d)/(2*a);
x2=(-b-d)/(2*a);

end %bquad_solver()