Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75234 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58709 invoked from network); 3 Jul 2014 17:29:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2014 17:29:15 -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:47976] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/01-49322-9E295B35 for ; Thu, 03 Jul 2014 13:29:13 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id E191688017A for ; Thu, 3 Jul 2014 13:29:09 -0400 (EDT) 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 Z9uOiU1o46Yy for ; Thu, 3 Jul 2014 13:29:09 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id B769288017E for ; Thu, 3 Jul 2014 13:29:07 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: Date: Thu, 3 Jul 2014 18:29:02 +0100 Content-Transfer-Encoding: quoted-printable Message-ID: <9515FDBA-80C1-42F8-9C6B-3EFC3239F596@ajf.me> References: To: PHP Internals X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] [DRAFT][RFC] Big Integer Support From: ajf@ajf.me (Andrea Faulds) Hello, I=92ve made a change to the RFC and patch, whereby NaN will cast to = integer zero instead of LONG_MIN. I think that makes a lot more sense and I haven=92t = put this under =93Open Questions=94 as I don=92t think anyone will really object. Also, I=92m reconsidering my earlier position on how to handle bigint to = long casting. (Userland can=92t cast to long, but zend_parse_parameters, = bitwise shifts etc. need to use zend_dval_to_lval sometimes.) While I have = currently made the patch cap the value at the maximum/minimum value if too = large/small, this is inconsistent with double to long casting which instead truncates = and preserves the lowest bits. For this reason, and because I think it=92s = better to keep as much information as possible rather than lose everything but the = sign, I will change it to truncate. Either way, I think there should be some sort of warning (probably an = E_NOTICE or E_WARNING?) when this cast happens implicitly and the number is = truncated, such as in function calls. I=92m tempted to remove this from Open = Questions and instead just Do The Right Thing and if someone objects later, the patch = and RFC can always be changed. Of course, it=92s worth noting we currently *don=92t* do any sort of = warning when casting a float to a long causes a loss of information. Anthony = Ferrara=92s sadly withdrawn RFC for scalar type hints would have done this for user land functions, but that hasn=92t happened yet, so adding a warning here = would be inconsistent with floats. Any thoughts? Thanks! -- Andrea Faulds http://ajf.me/