Solve a cubic polynomial using the trigonometric/Cardano formulation. This alternate implementation evaluates intermediate values in extended precision and returns real roots plus a root-case flag.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=pr), | intent(in) | :: | parameters(4) |
Coefficients of . |
||
| real(kind=pr), | intent(out) | :: | real_roots(3) |
Real roots; unused entries are not populated by this routine. |
||
| complex(kind=pr), | intent(out) | :: | complex_roots(3) |
Present for interface compatibility; not assigned here. |
||
| integer, | intent(out) | :: | flag |
|
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| real(kind=16), | public | :: | A | ||||
| real(kind=16), | public | :: | B | ||||
| real(kind=16), | public | :: | Q | ||||
| real(kind=16), | public | :: | R |
Cardano intermediate (not the gas constant). |
|||
| real(kind=16), | public | :: | alp | ||||
| real(kind=16), | public | :: | bet | ||||
| real(kind=16), | public | :: | d1 | ||||
| real(kind=16), | public | :: | d2 | ||||
| real(kind=16), | public | :: | d3 | ||||
| real(kind=16), | public | :: | gam | ||||
| integer, | public | :: | i |
Loop/index variable. |
|||
| real(kind=pr), | public, | parameter | :: | pi | = | atan(1.0_pr)*4.0_pr | |
| real(kind=16), | public | :: | theta |