There is a flag that can be set to prevent that:
Context("Complex");
Context()->functions->set(
sqrt => {negativeIsComplex => 0},
);
There is a similar flag for log
. You may also want to do
$context->operators->set(
'^' => {negativeIsComplex => 0},
'**' => {negativeIsComplex => 0},
);
so that you can't use (-2)^.5
either.