Roots of a quadratic function: Difference between revisions

Content added Content deleted
Line 1,452: Line 1,452:


=={{header|PARI/GP}}==
=={{header|PARI/GP}}==
{{works with|PARI/GP|2.8.0+}}
<lang parigp>roots(a,b,c)=polrootsreal(Pol([a,b,c]))</lang>

{{trans|C}}
{{trans|C}}
Otherwise, coding directly:
<lang parigp>roots(a,b,c)={
<lang parigp>roots(a,b,c)={
b /= a;
b /= a;
Line 1,465: Line 1,469:
};</lang>
};</lang>


Either way,
{{works with|PARI/GP|2.8.0+}}
<lang parigp>roots(a,b,c)=polrootsreal(Pol([a,b,c]))</lang>
<lang parigp>roots(1,-1e9,1)</lang>
gives one root around 0.000000001000000000000000001 and one root around 999999999.999999999.


=={{header|Pascal}}==
=={{header|Pascal}}==