Fix for issue 1780.

Fixed issue with pow grad function trying to evalutate log at 0.

Added unit test.
Note: issue still occurs in debugmode.