Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95550 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 97653 invoked from network); 2 Sep 2016 02:58:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2016 02:58:10 -0000 X-Host-Fingerprint: 2.123.198.163 unknown Received: from [2.123.198.163] ([2.123.198.163:11958] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 11/E9-47600-0CAE8C75 for ; Thu, 01 Sep 2016 22:58:09 -0400 Message-ID: <11.E9.47600.0CAE8C75@pb1.pair.com> To: internals@lists.php.net References: Date: Fri, 2 Sep 2016 03:58:03 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Posted-By: 2.123.198.163 Subject: Re: [PHP-DEV] Allow infinity integer length From: ajf@ajf.me (Andrea Faulds) Hi Björn and David, As the author of that proposal, I'd say it's more of a “was”. It was a huge project and I gave up on it. It could be attempted again, but I don't expect PHP 8 to be appearing very soon (and this is a change that would have to be in a major version), and I'm not sure if there's really such a big benefit. It's more a nice-to-have than a killer feature. After all, if you need arbitrary-precision integers with operator overloading and everything, ext/gmp already exists. And furthermore, the vast majority of applications don't need more than 64-bit integers. Thanks. Björn Larsson wrote: > There was / is a proposal about bigints, see: > > https://wiki.php.net/rfc/bigint > > Regards //Björn Larsson > > > Den 2016-08-29 kl. 15:48, skrev David Rodrigues: >> Currently PHP integer is limited to 2147483647 or 9223372036854775807 >> (PHP_INT_MAX), depending of system bits. We can works with long >> integers by using bcmath, for instance. But why not to support it >> natively? >> >> I mean, PHP can parse infinity integers, but it's converted to >> cientific notation or to INF. >> >> My suggestion is that, instead of convert it, stores the value in >> another format, an int[] or string, expanding depending of parsed >> length. >> >> Then accept things like: >> >> 10000000000000000000000000000000 + 10000000000000000000000000000000 = >> 20000000000000000000000000000000 >> >> Yeah, I know that it should be slower than normal ints, but is an >> exceptional case. It should avoid problems caused by untested code >> with very large numbers, for instance. >> >> Same for float values, but in this case I think that should have a >> best implementation to defines length of mantissa, for instance (new >> Float($float, $bits), for instance). But it can be part of another >> discussion. >> > -- Andrea Faulds https://ajf.me/