Hmm. I think that ir1 is actually correct and the other two are wrong! Indeed, `subst(%pi/4, x, i)`

gives `sqrt(-%i/sqrt(2) - 1/sqrt(2))`

, which I agree with. The argument of this number is half of %pi + %pi/4 and thus is 5/8*%pi and the real part should be negative. (I spent ten minutes staring at Argand diagrams until I was really really convinced).

Now, demoivre(i) gives `sqrt(- %i sin(x) - cos(x))`

, which I also believe to be correct. So there's some error in `realpart(sqrt(...))`

in this case (which I haven't found yet).