Roots of a quadratic function: Difference between revisions
m
→{{header|R}}
m (replaced buggy R version: where in hell did you see that roots are real when the real part of the discriminant is positive???) |
m (→{{header|R}}) |
||
Line 1,832:
=={{header|R}}==
<lang R>qroots <- function(a, b, c) {
z <- (-b
c(z, c / (z * a))
} else {
z <- (-b - r) / (2 * a)
c(z, c / (z * a))
}
}
qroots(1, 0, 2i)
[1]
qroots(1, -1e9, 1)
[1] 1e+09+0i 1e-09+0i</lang>
=={{header|Racket}}==
|