Fix real assumption for gamma function.

Fixes #8657

@pelegm @skirpichev