Jelly, 8 bytes
Ær,NċAƲƇ
A monadic Link that accepts a list of polynomial coefficients ([...,d,c,b,a]
) and yields the real roots.
Try it online! Or see the test-suite.
How?
The heavy lifting is done by a built-in...
Ær,NċAƲƇ - Link: coefficients, P
Ær - polynomial roots (of P)
Ƈ - keep those for which:
Ʋ - last four links as a monad - f(x):
N - negate (x)
, - (P) paired with (that)
A - absolute value (of x)
ċ - count occurrences (of that in the pair) -> 1 if x is real, 0 if not