Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81744 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 76205 invoked from network); 3 Feb 2015 22:35:32 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Feb 2015 22:35:32 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:47526] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/2B-20608-33D41D45 for ; Tue, 03 Feb 2015 17:35:32 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id BAABC8800A2; Tue, 3 Feb 2015 17:35:28 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id aAf1GGofIFsS; Tue, 3 Feb 2015 17:35:28 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 12EF48800DB; Tue, 3 Feb 2015 17:35:27 -0500 (EST) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <54D14268.3050500@lsces.co.uk> Date: Tue, 3 Feb 2015 22:35:25 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <57216450-F110-401D-A42C-63F1E92C8645@ajf.me> References: <8C47FA53-0964-49C0-963C-332A936348A5@ajf.me> <54D00C40.8060907@lsces.co.uk> <54C5DC93-9600-4EE2-BF06-7BF10FC6AD5C@ajf.me> <54D08D50.5050407@lsces.co.uk> <1C2ED70C-72A0-4513-A134-5DAE4CCA5B3D@ajf.me> <54D0DFE5.9030602@lsces.co.uk> <06F175EB-D44A-445F-8015-8421C7C12F39@ajf.me> <54D14268.3050500@lsces.co.uk> To: Lester Caine X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] [RFC] Big Integer Support From: ajf@ajf.me (Andrea Faulds) > On 3 Feb 2015, at 21:49, Lester Caine wrote: >=20 > On 03/02/15 16:44, Andrea Faulds wrote: >> Sure, but I don=92t think we shouldn=92t cripple the language merely = for the sake of really low-end embedded devices. Also, I=92m not = convinced that the overhead, at least in terms of file size, is really = that big of an issue. >=20 > 'I don=92t think we should cripple' ? >=20 > There are two views on the handling of integers. Obviously it would be > nice if there was no limit to the size of a number and there are > situations where that is indeed useful. However there are equally > situations where both the natural 32bit and 64bit limits of the target > hardware and software needs to be observed and these require a = different > method of handling things like 'overflow=92. Maybe. But PHP has never cared about those things. We promote to float = when integers would =93overflow=94 in another language. > Simply automatically > upgrading an integer value to a more complex object depending on what > hardware one is running on adds the overhead of having to create code = to > disable things depending on some hardware flag. Not really. We already do promotion for integers to float, and it=92s a = very simple operation to check for overflow, natively supported by many = compilers, and we also have a pure C fallback. All that bigints do is = that instead of promoting to float, we promote to bigints. There=92s no = new overhead, these checks already existed, and have done for well over = a decade. The only complexity bigints add are the addition of the new IS_BIGINT = type (which goes in your operator type matrices etc.), and requiring = some bigint library. > With the bulk of SQL persistent data having to manage both 32 and = 64bit > integer limits and the matching float/numeric limits, a system of > working which mirrors that would naturally seem to be the sensible > default. Why should it match SQL? Why should we have the complexity of two = different sizes of integer? Why not just have a single, unified = arbitrary-precision integer type, like the RFC proposes. > If those limitations have been avoided by the use of additional > libraries, then a matching additional library in PHP also comes into = play. >=20 > Currently we have a problem with the size of integers, but simply > ignoring that there are limits is not the may to fix that problem. This RFC doesn=92t ignore that there are limits. Arbitrary-precision = integers are, naturally, bounded by available RAM (including the request = memory limit). -- Andrea Faulds http://ajf.me/