def g(x,returntype=LINALGMAXFLOAT): ''' Evaluates g(x)=log(1+exp(x)) as accurately as possible. ''' return returntype(np.logaddexp(ZERO128,np.float128(x)))