Solve a real cubic polynomial with coefficients .
Uses the discriminant to distinguish three real roots, repeated real roots, and one real root with a complex-conjugate pair. Unused slots in the output arrays are set to NaN.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | parameters(4) |
Polynomial coefficients in . |
||
| real(kind=pr), | intent(out) | :: | real_roots(3) |
Real roots; unused entries are NaN. |
||
| complex(kind=pr), | intent(out) | :: | complex_roots(3) |
Reserved complex-root output; this solver currently leaves NaN sentinels. |
||
| integer, | intent(out) | :: | flag |
Root case: |
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=pr), | public | :: | disc | ||||
| real(kind=pr), | public | :: | nan | ||||
| real(kind=pr), | public | :: | p | ||||
| real(kind=pr), | public, | parameter | :: | pi | = | atan(1.0_pr)*4.0_pr | |
| real(kind=pr), | public | :: | q | ||||
| real(kind=pr), | public | :: | theta | ||||
| real(kind=pr), | public | :: | u | ||||
| real(kind=pr), | public | :: | v |