AGM method -- much faster for large inputs