memoizing exponentials properly