add some numerical handling to Pow imaginary/real handlers

When the argument of the base of a power is a rational number, detecting real or imaginary values is possible. This processing was added to Pow._eval_is_imaginary and Pow._eval_is_real. In addition, a quicker exit was implemented.
fixed here and elsewhere