Fix type of tanh.

Found using random testing.