Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65770 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86238 invoked from network); 11 Feb 2013 21:57:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Feb 2013 21:57:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:52316] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/42-04899-E4969115 for ; Mon, 11 Feb 2013 16:57:35 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 59D8F700044C; Mon, 11 Feb 2013 21:57:31 +0000 (WET) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id wDw1c+b-OV6g; Mon, 11 Feb 2013 21:57:31 +0000 (WET) Received: from mail2.ist.utl.pt (mail.ist.utl.pt [IPv6:2001:690:2100:1::8]) by smtp1.ist.utl.pt (Postfix) with ESMTP id DBFB7700043C; Mon, 11 Feb 2013 21:57:30 +0000 (WET) Received: from damnation.nl.lo.geleia.net (unknown [IPv6:2001:470:94a2:4:21d:baff:feee:cc0b]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 0695A20084A2; Mon, 11 Feb 2013 21:57:28 +0000 (WET) Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: "PHP Internals" , "Remi Collet" References: <511666DE.8080809@fedoraproject.org> <51172819.4000806@sugarcrm.com> <51174790.8040805@fedoraproject.org> <511751C5.1020906@fedoraproject.org> <51175BDD.9040705@sugarcrm.com> <5117BA92.8080307@fedoraproject.org> <5118AF38.609@fedoraproject.org> Date: Mon, 11 Feb 2013 22:57:23 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: Quoted-Printable Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: <5118AF38.609@fedoraproject.org> User-Agent: Opera Mail/12.12 (Linux) Subject: Re: [PHP-DEV] double val to long val conversion issue From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Mon, 11 Feb 2013 09:43:36 +0100, Remi Collet = = wrote: > Le 10/02/2013 20:27, Gustavo Lopes a =C3=A9crit : > >> Any reservations? > > For which values ? Outside LONG_MIN .. ULONG_MAX ? It should be valid for the whole domain, but for performance reasons it = = would be better to limit it to values at least outside the (LONG_MIN, = LONG_MAX) interval. Testing also against LONG_MIN has a measurable = performance hit in my tests (+40%), but that should not matter (on my ol= d = laptop, you can still run the inlined function 1e9 times per second for = = values in the long range, i.e., it takes around 1 ns). > Do we really want/need to change the current behavior. > > Cast from double, outside of integer range, result in a fix value. > > The only problem is that the value is not the same on all arch. Sure, that is also an option, but since we already have a wrapping = behavior in the LONG_MAX..ULONG_MAX range, it would make sense to keep a= = similar behavior throughout the double domain, I think. It would be = inconsistent to have it wrap on LONG_MAX, but for values smaller than = LONG_MIN or larger than ULONG_MAX give a fixed value. -- = Gustavo Lopes