Roots of a quadratic function: Difference between revisions
Content deleted Content added
Alextretyak (talk | contribs) Added 11l |
m →{{header|FreeBASIC}}: corrected typo |
||
Line 753:
Case 1
f = (1 + Sqr(1 - 4 * a *c / b ^ 2)) / 2
Print "
Case -1
Print "
End Select
End Sub
Line 858:
Find root(s) for 1X^2-1000000000X+1
1: the real roots are 1000000000 and 0
3: the real roots are 9.9999999999999999900000000e+08 and 1.0000000000000000010000000e-09
Find root(s) for 1X^2+0X+1
1: the complex roots are -0 +/- 1*i
3: the complex roots are 0.0000000000000000000000000e+00 +/- 1.0000000000000000000000000e+00*i
Find root(s) for 2X^2-1X-6
1: the real roots are 8 and -6
3: the real roots are 2.0000000000000000000000000e+00 and -1.5000000000000000000000000e+00
Find root(s) for 1X^2+2X-2
1: the real roots are 0.7320508075688772 and -2.732050807568877
3: the real roots are 7.3205080756887729352744634e-01 and -2.7320508075688772935274463e+00
Find root(s) for 0.5X^2+1.4142135623731X+1
1: the real roots are -0.3535533607909526 and -0.3535534203955974
3: the real roots are -1.4142134436707580875788206e+00 and -1.4142136810754419733330398e+00
Find root(s) for 1X^2+3X+2
1: the real roots are -1 and -2
3: the real roots are -1.0000000000000000000000000e+00 and -2.0000000000000000000000000e+00
Find root(s) for 3X^2+4X+5
1: the complex roots are -0.6666666666666666 +/- 1.105541596785133*i
3: the complex roots are -6.6666666666666666666666667e-01 +/- 1.1055415967851332830383109e+00*i
Find root(s) for 1X^2-1e+100X+1
1: the real roots are 1e+100 and 0
3: the real roots are 1.0000000000000000159028911e+100 and 9.9999999999999998409710889e-101
Find root(s) for 1X^2-1e+200X+1
1: the real roots are 1.#INF and -1.#INF
3: the real roots are 9.9999999999999996973312221e+199 and 0.0000000000000000000000000e+00
Find root(s) for 1X^2-1e+300X+1
1: the real roots are 1.#INF and -1.#INF
3: the real roots are 1.0000000000000000525047603e+300 and 0.0000000000000000000000000e+00</pre>
=={{header|GAP}}==
<lang gap>QuadraticRoots := function(a, b, c)
|