Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:95501 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30074 invoked from network); 29 Aug 2016 13:48:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Aug 2016 13:48:55 -0000 Authentication-Results: pb1.pair.com smtp.mail=david.proweb@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=david.proweb@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.177 as permitted sender) X-PHP-List-Original-Sender: david.proweb@gmail.com X-Host-Fingerprint: 209.85.220.177 mail-qk0-f177.google.com Received: from [209.85.220.177] ([209.85.220.177:34498] helo=mail-qk0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 03/59-34481-64D34C75 for ; Mon, 29 Aug 2016 09:48:55 -0400 Received: by mail-qk0-f177.google.com with SMTP id t7so137877885qkh.1 for ; Mon, 29 Aug 2016 06:48:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=d1ASECcxntIPuFJPRZT7q9jYQ9Q/3HTptom6dmyVe7g=; b=LEOU357LLKU+itb6VW5bGNRPYLGooSd2JIxRkmWWj/bZljIjp+6bFsY4VcepO9zKZr Q3lzMVDYgXJh0BqkYiuNQkA+qQ1ykItsYWc//YKpicMaBudMgz4pr5X11GI9Q6VXdOYz kN50zrsXXbl+0t1tD2cQ8ch0K1epAYp//jW6jRKZkpSBMDTRvL/3UP8NqCydxFZyFxzb 6Pkw1c5pSU7Jiyl+Xg36RpQXQJLyx2l3iYPn++n6XggUGal5uJUzG7ny9aGcEPwlLUWw YtAgiMIfvS/6rQOUJ1K0mLLQ2xzFxvkjfWi4bbqSg1NcwQof2wwNVurX17TKPX02FAwu vBiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=d1ASECcxntIPuFJPRZT7q9jYQ9Q/3HTptom6dmyVe7g=; b=j4woAo3ZGGVBWAG0P9FY3ku7fu8LPtuNvDZwCfSRpEim+5JMQZiW3HkI9URF3vwKUo +xiSPrMJTXIfRiTqlGIMBXNJiDUWzobRN0XZrFGk/1/63d1TfOPo0+wLtL00/q3l6A9A 1yY2zZivWnjxSNegdbi+E+ywdgtQJl9wBHwADhxXJHZXCP/DI232zocDauQy7atV1cdt +I1PBz8Qeu8wO4hqJxl8oIiYpo6lMmpNYwl+I81eIu179rhbW5x2yMTPKTIimRY10kuy khnQ0UU+m87NfQs1zyIWtFltay8uDoY/Wcsxaqn9AHP8JQ0sB2BsTXUjbvonetXGL/e+ WIMw== X-Gm-Message-State: AE9vXwOLreuCVIa7Pd7I5nXXGr5yyxRVp/+l1JxePMQ6czqAh33Elt8i0ykKxdKvvF4VU2BPGEu0WBY3TrorCw== X-Received: by 10.55.150.130 with SMTP id y124mr19571992qkd.14.1472478531968; Mon, 29 Aug 2016 06:48:51 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.45.67 with HTTP; Mon, 29 Aug 2016 06:48:31 -0700 (PDT) Date: Mon, 29 Aug 2016 10:48:31 -0300 Message-ID: To: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Allow infinity integer length From: david.proweb@gmail.com (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. -- David Rodrigues