Handle special cases correctly in exponentation functions.