calculating exponential